[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Linking automatically with dlopen
From: |
Ralf Wildenhues |
Subject: |
Re: Linking automatically with dlopen |
Date: |
Tue, 17 Apr 2007 20:32:18 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Hello Reuben,
To add to Bob's answer:
* Reuben Thomas wrote on Mon, Apr 16, 2007 at 02:01:24AM CEST:
>
> I want to be able to link against a library which may not be present at
> runtime, be certain that the application starts up (i.e. the dynamic linker
> doesn't discover that a library is missing and abort), and then be able to
> find out whether a given library was successfully linked or not (and hence
> decide whether I can execute code that uses symbols from that library).
If you can find out the set of libraries at 'configure' time, then there
is no need for dlopen. Otherwise, no, I don't see another way.
For increased portability, you can use libltdl and lt_dlopen the library.
> (I'm not quite clear, but perhaps doing this fully automatically is beyond
> the scope of libtool and needs linker support?)
Doing this fully automatically does not work on any system I know of.
AIX in some cases allows startup with some symbols not yet defined, but
that's pretty obscure. I don't think it works with libs that may or may
not be present, though.
> The use I have in mind is linking CODECs with different licenses into an
> application without needing to change the code so that the CODECs are
> dlopened. Then, if certain CODECs are not available, the application can
> simply give an error message if the user attempts to use them, but the
> application author doesn't need to write (or in this case, re-write) the
> code to use dlopen.
This is the typical application for dlopen/lt_dlopen.
Hope that helps.
Cheers,
Ralf