Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-11-2011, 11:15 AM
|
#1
|
Member
Registered: Nov 2010
Posts: 57
Rep:
|
_dl_open in libc.so?
i know that there is a function in libld.so called dlopen for share libraries loading, but i heard that there is another function called _dl_open in libc.so (which is better than libld.so sine libc is more reliable and guaranteed to exists) also if i used libc.so will be better to reduce libraries used by my software.
but i cant seem to find it in any include files :/
cheers;
thanks.
|
|
|
03-11-2011, 12:04 PM
|
#2
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,520
|
/usr/lib/libc.so is a text file :
Code:
/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
OUTPUT_FORMAT(elf32-i386)
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.2 ) )
/lib/ld-linux.so.2 -> ld-2.10.1.so ( Provided by glibc ).
Code:
$ readelf -s /lib/ld-linux.so.2 | grep dl_open
196: 4806c750 2145 FUNC LOCAL DEFAULT 10 dl_open_worker
373: 4806c250 616 FUNC LOCAL HIDDEN 10 _dl_open
Last edited by knudfl; 03-11-2011 at 12:08 PM.
|
|
|
03-11-2011, 12:53 PM
|
#3
|
Member
Registered: Nov 2010
Posts: 57
Original Poster
Rep:
|
i dont get it !
|
|
|
03-11-2011, 02:23 PM
|
#4
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,520
|
You were looking for the object by name "_dl_open".
"_dl_open" is in the library ld-<glibc-version>.so .
'ld-linux.so.2' is a link to 'ld-<glibc-version>.so'
And that library is created when glibc is being build.
Please explain, what it is, you don't understand.
..
|
|
|
03-11-2011, 02:37 PM
|
#5
|
Senior Member
Registered: May 2005
Posts: 4,481
|
Quote:
Originally Posted by KillerCode
i dont get it !
|
A library may be an object file or a linker script.
|
|
1 members found this post helpful.
|
03-12-2011, 10:23 PM
|
#6
|
Member
Registered: Nov 2010
Posts: 57
Original Poster
Rep:
|
ok, thats new, so no _dl_open in libc? i thought because libc is already used by my app, so i can use all functions from it, and avoid linking libld.so.
so this means there is no way out? ill have to link to libld.so?
|
|
|
03-14-2011, 02:20 AM
|
#7
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,520
|
The object ""_dl_open"" is in libc only ! Nowhere else ! → → post # 2
The name of the libc library holding this object is ld-<glibc-version>.so
|
|
|
03-14-2011, 08:54 AM
|
#8
|
Member
Registered: Nov 2010
Posts: 57
Original Poster
Rep:
|
oh, so i still have to link another library? if thats the case then its pointless !!
|
|
|
03-14-2011, 11:53 AM
|
#9
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,520
|
ld-<glibc-version>.so is always installed.
All binaries, including all commands depend on ld-linux.so.2 -> ld-<glibc-version>.so
..
Last edited by knudfl; 03-15-2011 at 05:27 AM.
|
|
1 members found this post helpful.
|
03-30-2011, 06:09 PM
|
#10
|
LQ Newbie
Registered: Mar 2011
Posts: 2
Rep:
|
How can I load a library using this function and nasm, when I know the function address? I know that in eax I should store pointer to the string with new library path, in ebx mode (probably 0x80000000 | RTLD_LAZY, but why 0x80000000?), and what about ecx? What should be placed there? I found that the caller, but what it's?
|
|
|
03-31-2011, 04:59 AM
|
#11
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,520
|
|
|
|
All times are GMT -5. The time now is 05:44 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|