On Feb 9, 2009, at 5:37 AM, Rahulkumar wrote:

Can somebody tell me why this is done? What's need of including the file in
/usr/local/lib even though we included it in project directly?

It's a feature of Mach-O, the executable format used by Mac OS X. When you link a binary against a library, the installation path of the library is copied into the binary. Then dyld expects the library to be at that path, and if it isn't, then the binary will not load.

You can see this for yourself by running "otool -L" on the binary.

Why it's necessary to include .dylib file to project as well as to
/usr/local/lib?


It isn't. It's only necessary to put the library in the place where dyld expects it to be located in order to load the binary, which, in this case, is /usr/local/lib.

That said, you can change this, by rebuilding the library with the installation path you want, or by using the install_name_tool program. If you need to embed the library in an app bundle, then you should read up about the @executable_path and @loader_path macros.

Nick Zitzmann
<http://www.chronosnet.com/>

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to