Re: Static linking with the Mach-O linker in PB
Re: Static linking with the Mach-O linker in PB
- Subject: Re: Static linking with the Mach-O linker in PB
- From: "Alastair J.Houghton" <email@hidden>
- Date: Wed, 4 Jun 2003 00:01:27 +0100
On Monday, June 2, 2003, at 07:15 pm, Daniel Aarno wrote:
I'm working on a project that requires one non-default library
(libpoll) and I'd like to link statically with this library (but not
others). How can I specify on a library basis how to link (in PB).
There is a cleaner way to do this than the delete-the-dylib approach
most people seem to have suggested; in the Settings for your target, go
to Linker Settings and add *the full name* (e.g.
"/usr/local/lib/libpoll.a") of the library you want to statically link
with to the "Other Mach-O Linker Flags" (or edit OTHER_LDFLAGS in
Expert View). I just tested this with one of my own programs, and it
seems to work just fine.
Interestingly, the stuff in /Developer/Makefiles seems to suggest that
there might be an OTHER_LIBS variable as well, but when I tried that it
didn't work. Often, makefile rules for linking look like this:
foo: $(OBJS)
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@
which on many (most?) systems means you need to put libraries in the
LIBS variable because otherwise some symbols won't be resolved
(basically, most linkers search libraries in the order they are written
on the command line [or in their input file], so at the very least they
need to be *after* the object files). It surprised me slightly
therefore that OTHER_LIBS doesn't seem to work, especially as Apple's
man pages seem to indicate that the order is significant...
Kind regards,
Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.