For the More Curious: libtool
Earlier in the chapter, the class Unix tools ar and ranlib were used to build static libraries, and gcc was used to build a dynamic library. Mac OS X has a tool, libtool, which is peculiar to the platform, but provides a superset of features over ar and friends. The GNU project also has a libtool, but it is unrelated to the one in Mac OS X.
Make a static library like this and use it:
$ libtool -static -o libaddum.a src?.o
$ gcc -g -o useadd useadd.m -L. -laddum
And dynamic libraries (but not bundles) can be created thusly:
$ libtool -dynamic -macosx_version_min 10.5 -o libaddum.dylib ...
Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.