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: making dynamic libraries with gcc



On 23/01/2004, at 5:00 PM, Rich Cook <email@hidden> wrote:
In trying to port a large library to OS X, we would like to learn how
to create a dynamically loadable library (a .dylib object) with gcc on
darwin.  The documentation on Apple's site all assumes we're using
XCode, but we are using our own build system.
Given a file foo.c, with several functions defined in it, how to create
a foo.dylib file that can be used as argument to dlopen()?  Thanks.

Something like
gcc -dynamiclib -o foo.dylib foo.c -lbar
should do the trick.  See the manual for gcc and the man page for ld.

However, that is the hard way. If you want something portable use autoconf/automake and libtool. They understand MacOS X as well as a squillion other systems. If the package is already autoconfed, it might well build with the standard configure then make.

Bill Northcott
_______________________________________________
scitech mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/scitech
Do not post admin requests to the list. They will be ignored.



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.