• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why its necessary to include .dylib file to project as well as to /usr/local/lib?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Why its necessary to include .dylib file to project as well as to /usr/local/lib? (From: "Rahulkumar" <email@hidden>)

  • Prev by Date: Re: NSScreen order?
  • Next by Date: Re: underlining
  • Previous by thread: Why its necessary to include .dylib file to project as well as to /usr/local/lib?
  • Next by thread: NSSavePanel called from BSD application - no keyboard input
  • Index(es):
    • Date
    • Thread