Re: Why its necessary to include .dylib file to project as well as to /usr/local/lib?
Re: Why its necessary to include .dylib file to project as well as to /usr/local/lib?
- Subject: Re: Why its necessary to include .dylib file to project as well as to /usr/local/lib?
- From: Nick Zitzmann <email@hidden>
- Date: Tue, 10 Feb 2009 09:45:09 -0700
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 (email@hidden)
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:
This email sent to email@hidden