O'Reilly logo

Advanced Mac OS X Programming: The Big Nerd Ranch Guide by Mark Dalrymple

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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​ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required