Re: linking shared libraries with dependent shared libraries
Re: linking shared libraries with dependent shared libraries
- Subject: Re: linking shared libraries with dependent shared libraries
- From: "Peter O'Gorman" <email@hidden>
- Date: Wed, 13 Oct 2004 11:36:46 +0900
Paul Forgey wrote:
I'm trying to port our product to OS X/Darwin. It makes heavy use of
shared libraries and it currently runs on Linux and Windows. On OS X,
I'm using twolevel_namespace.
As the shared libraries are built, they are output into a common
directory across the source tree. This allows the ELF targets to find
dependent shared libraries as needed while either another shared library
or an executable is linked.
e.g.:
shlib1
shlib2
depends on shlib1
exe
depends on shlib2
On OS X, I can't figure out how to get ld to search the same directory
shlib2 was in to find shlib1. With Windows this doesn't matter since
the DLL worries about other dependents at load time. With Linux, ld
searches the same directory.
I know I could work around this by explicitly linking shlib1 to exe.
However, this is very impractical because it would make the build
process very clumsy. Not only would the developer have to play
detective to find out what the entire dependency tree is, but the entire
build tree would have to be gone through if a heavily used library
changed its dependents.
Don't tell me to use frameworks. This isn't a Darwin-only project.
How about telling you to read the manpage for ld(1)? :-p
-dylib_file is the flag you need. On many platforms -L is used to search for
symbols in dependent shared libraries, on darwin, the install_name that is
encoded into the shared lib is the method that is used. If the dependent
shared library is not yet installed then you have to use the -dylib_file flag.
Hope this helps,
Peter
--
Peter O'Gorman - http://www.pogma.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden