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:

$​ ​l​i​b​t​o​o​l​ ​-​s​t​a​t​i​c​ ​-​o​ ​l​i​b​a​d​d​u​m​.​a​ ​s​r​c​?​.​o​
$​ ​g​c​c​ ​-​g​ ​-​o​ ​u​s​e​a​d​d​ ​u​s​e​a​d​d​.​m​ ​-​L​.​ ​-​l​a​d​d​u​m​

And dynamic libraries (but not bundles) can be created thusly:

$​ ​l​i​b​t​o​o​l​ ​-​d​y​n​a​m​i​c​ ​-​m​a​c​o​s​x​_​v​e​r​s​i​o​n​_​m​i​n​ ​1​0​.​5​ ​-​o​ ​l​i​b​a​d​d​u​m​.​d​y​l​i​b​ ...

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.