Re: Linking automatically with dlopen

2007-04-16 Thread Reuben Thomas

On Sun, 15 Apr 2007, Bob Friesenhahn wrote:


On Mon, 16 Apr 2007, Reuben Thomas wrote:

Is there a way to use libtool to link against a library using dlopen? 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).


This is a function of libltdl, which comes with libtool.  I use it in 
GraphicsMagick.


I read the documentation for libltdl before posting originally, but I 
couldn't see how to do what I wanted. Can you explain, please? In 
particular, I couldn't see how to link using libltdl instead of the normal 
linker without changing my source.


--
http://rrt.sc3d.org/ | think tank, n.  a safe container for noxious gases


___
http://lists.gnu.org/mailman/listinfo/libtool


Re: Linking automatically with dlopen

2007-04-16 Thread Bob Friesenhahn

On Mon, 16 Apr 2007, Reuben Thomas wrote:

This is a function of libltdl, which comes with libtool.  I use it in 
GraphicsMagick.


I read the documentation for libltdl before posting originally, but I 
couldn't see how to do what I wanted. Can you explain, please? In particular, 
I couldn't see how to link using libltdl instead of the normal linker without 
changing my source.


I see what you want to do.  The intention of libltdl is to provide a 
portable replacement for dlopen() while also supporting static 
compilation.  By loading a library/module with global scope, you may 
achieve some success, but initialization becomes highly order 
dependent and subsequent library/module loads wil fail if their symbol 
dependencies are not satisified.  Using libltdl requires source 
changes.


Bob
==
Bob Friesenhahn
[EMAIL PROTECTED], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,http://www.GraphicsMagick.org/



___
http://lists.gnu.org/mailman/listinfo/libtool