dynamic link loader

dynamic link loader

Post by Davi » Wed, 10 Nov 1999 04:00:00



I know FreeBSD has dlopen(), dlsym(), etc...  but will it ever have
libdl or at least a port of it?

Thanks
David

 
 
 

dynamic link loader

Post by Chris Costell » Thu, 11 Nov 1999 04:00:00



> I know FreeBSD has dlopen(), dlsym(), etc...  but will it ever have
> libdl or at least a port of it?

   Just write a library with weak symbols for them.

   Compile this C source into a library.

------ (begin) ------
void *dlopen(const char *, int);
void *dlsym(void *, const char *);
const char *dlerror(void);
int dlclose(void *handle);
------- (end) -------

   Though I don't see why you need it.



 
 
 

dynamic link loader

Post by Donn Mille » Thu, 11 Nov 1999 04:00:00



> I know FreeBSD has dlopen(), dlsym(), etc...  but will it ever have
> libdl or at least a port of it?

Very good point.  I know our -lc (libc) has these functions, but
you make a good point in having these extricated into a libdl.
However, the only good this may do is compatibility with Linux's
dlopen(), which on Linux resides in -libdl.  You may want to bring

--
- Donn

 
 
 

dynamic link loader

Post by Chris Costell » Thu, 11 Nov 1999 04:00:00



> Very good point.  I know our -lc (libc) has these functions, but
> you make a good point in having these extricated into a libdl.
> However, the only good this may do is compatibility with Linux's
> dlopen(), which on Linux resides in -libdl.  You may want to bring


   See my previous post.  There's no need to bloat our source
tree any more with that sort of thing, in my opinion.


 
 
 

dynamic link loader

Post by Jan Andre » Thu, 11 Nov 1999 04:00:00




> > I know FreeBSD has dlopen(), dlsym(), etc...  but will it ever have
> > libdl or at least a port of it?

>    Just write a library with weak symbols for them.

>    Compile this C source into a library.

> ------ (begin) ------
> void *dlopen(const char *, int);
> void *dlsym(void *, const char *);
> const char *dlerror(void);
> int dlclose(void *handle);
> ------- (end) -------

>    Though I don't see why you need it.

Good point. Why not just:

# cd /usr/local/lib
# gcc -shared -Wl,-soname,libdl.so.1 -o libdl.so.1 -x c /dev/null
# ln -s libdl.so.1 libdl.so

Why you would need this? Well, there are some bloated autoconf scripts
which test for a particular feature which is present in a FreeBSD
system, but try to link their test binary against -ldl and so fail.
This is, of course, not a solution, but a good bug-compatibility
`feature' IMO.

--

             "Bell Labs Unix -- reach out and grep someone."

 
 
 

dynamic link loader

Post by Chris Costell » Fri, 12 Nov 1999 04:00:00



> Good point. Why not just:

...

Quote:> Why you would need this? Well, there are some bloated autoconf scripts
> which test for a particular feature which is present in a FreeBSD
> system, but try to link their test binary against -ldl and so fail.
> This is, of course, not a solution, but a good bug-compatibility
> `feature' IMO.

   I don't understand (nor do I want to understand) autoconf.  I
assumed the way autoconf searches for a function in a library is
by looking at the symbols (man nm).


 
 
 

dynamic link loader

Post by Paul Southwor » Fri, 12 Nov 1999 04:00:00




Quote:>> Why you would need this? Well, there are some bloated autoconf scripts
>> which test for a particular feature which is present in a FreeBSD
>> system, but try to link their test binary against -ldl and so fail.

That is not a smart test.  That is not the fault of autoconf.

Quote:>> This is, of course, not a solution, but a good bug-compatibility
>> `feature' IMO.

>   I don't understand (nor do I want to understand) autoconf.  I
>assumed the way autoconf searches for a function in a library is
>by looking at the symbols (man nm).

autoconf lets you roll up just about any test you want.  In general,
functions are tested by using them - compiling a code snippet and
linking with specific libraries.  This allows you to also test whether
the function takes the number and type of arguments you expect.

I am not a particular fan of autoconf, but like most tools, it should
probably be seen as a length of rope.  If someone writes a bad autoconf
script which is not portable, the rest of the world should not alter
their operating systems to fit.

--Paul

 
 
 

dynamic link loader

Post by Donn Mille » Sat, 13 Nov 1999 04:00:00



> Why you would need this? Well, there are some bloated autoconf scripts
> which test for a particular feature which is present in a FreeBSD
> system, but try to link their test binary against -ldl and so fail.
> This is, of course, not a solution, but a good bug-compatibility
> `feature' IMO.

I don't think it's necessary.  I find it easier to just have the
autoconf package installed, and modify configure.in.  There, you
can pretty much change all occurrences of -ldl to -lc by hand,
and then run autoconf.  Or, if configure.in isn't present, just
modify configure.

--
- Donn

 
 
 

dynamic link loader

Post by Jan Andre » Sat, 13 Nov 1999 04:00:00



> # cd /usr/local/lib
> # gcc -shared -Wl,-soname,libdl.so.1 -o libdl.so.1 -x c /dev/null
> # ln -s libdl.so.1 libdl.so

Or just,

# ar r /usr/local/lib/libdl.a

Who wants an empty library to be linked dynamically? ;-)

--

             "Bell Labs Unix -- reach out and grep someone."

 
 
 

dynamic link loader

Post by Jan Andre » Sat, 13 Nov 1999 04:00:00





> >> Why you would need this? Well, there are some bloated autoconf scripts
> >> which test for a particular feature which is present in a FreeBSD
> >> system, but try to link their test binary against -ldl and so fail.

> That is not a smart test.  That is not the fault of autoconf.

You misunderstood me. I know you can write quite smart tests with
autoconf, but some people are actually writing dumb tests, and instead
of fixing them (which can be annoying if they don't include
configure.in), you can create an empty library and it'll just work.

Quote:> >> This is, of course, not a solution, but a good bug-compatibility
> >> `feature' IMO.

> >   I don't understand (nor do I want to understand) autoconf.  I
> >assumed the way autoconf searches for a function in a library is
> >by looking at the symbols (man nm).

> autoconf lets you roll up just about any test you want.  In general,
> functions are tested by using them - compiling a code snippet and
> linking with specific libraries.  This allows you to also test whether
> the function takes the number and type of arguments you expect.

> I am not a particular fan of autoconf, but like most tools, it should
> probably be seen as a length of rope.  If someone writes a bad autoconf
> script which is not portable, the rest of the world should not alter
> their operating systems to fit.

I wasn't talking about extending FreeBSD by an empty libdl. ;-) I just
wanted to point to an easy way of making these dumb tests work.

Btw, is -ldl a very Linux specific feature? Or are there many other
OSes that also habe a libdl?

--

             "Bell Labs Unix -- reach out and grep someone."

 
 
 

dynamic link loader

Post by Patrick TJ McPh » Sun, 14 Nov 1999 04:00:00




% Btw, is -ldl a very Linux specific feature? Or are there many other
% OSes that also habe a libdl?

There are other OSes which also have libdl.
--

Patrick TJ McPhee
East York  Canada

 
 
 

1. Dynamic Link Loader problem

I installed the new XFree 1.3 on my Linux machine today and I'm not
able to run any X program, the problem seems to be with the Dynamic
Loader it reports this:

xterm: can't load library '//libXaw.so.3'

That library exists but it's in /lib/libXaw.so.3

Any help will be apreciated, thanks in advance,
Miguel.

--

Miguel.

2. Formatting partition for solaris

3. dynamic link loader

4. Strange gateway issues

5. dynamic loading vs. dynamic linking

6. Q: which of Intel Zappa/Intel Triton mb?

7. shmem works static-linked, but not dynamic-linked

8. Leafnode 1.4 does not delete old articles?

9. dynamic linking -> static linking == some _smaller_ executables

10. Static linked std libraryes in Dynamic linked libraryes

11. time launching aspect : static link vs dynamic link

12. dynamic linking vs. static linking

13. Dynamic linking and link editor