Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shared Objects and dyLibs



Florent wrote:

I am currently working on an OpenAL port to Darwin/MacOS X and I am having some troubles when building a dynamic library.
I used the -dynamiclib option with cc to build the dynamic library, and I got the following error :

ld: common symbols not allowed with MH_DYLIB output format

You must compile the source files with the '-fno-common' compiler flag. I'm not sure what they mean with common symbols, but using the flag helps. ;-)

Probably you'll also need to specify the '-undefined suppress' flag when linking...

Is the MH_DYLIB format the closest Darwin equivalent to Linux shared objects (.so) files? And what is the difference between dyLibs and bundles?
Darwin has a quite different dynamic linking system than other unixes...

The format produced by '-dynamiclib' is for shared libraries. They should be named 'libfoo.dylib' and you link against them like on any other Unix. The format produced by '-bundle' is for dynamic loading. These files should be named 'anything.so' and can be loaded at run time via dyld's API, or via a dlopen() wrapper (there is one in CVS cctools, and an enhanced version at http://download.sourceforge.net/fink/dlcompat-20010123.tar.gz).

Is there any good documentation or FAQ about dynamic linking on Darwin?

Not quite. There are some man pages, the <mach-o/dyld.h> header file, and the Compiler Release Notes. And then there's the source. Someone correct me if I'm wrong...

Hope this helps,
chrisp

--
chrisp a.k.a. Christoph Pfisterer "A computer scientist is
email@hidden - http://chrisp.de someone who fixes things
PGP key & geek code available that aren't broken."


References: 
 >Shared Objects and dyLibs (From: Florent <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.