Re: dylib library from
Re: dylib library from
- Subject: Re: dylib library from
- From: Jean-Daniel Dupas <email@hidden>
- Date: Tue, 18 Mar 2008 10:02:23 +0100
Le 18 mars 08 à 05:49, David Hinz a écrit :
What are the steps necessary to use a standard dynamic C++ library from one project in another project?
I created a dylib library in one project and then dragged the .h file and dylib library from that project to another project. The application links with the library but when I try to run it I get the following error:
dyld: Library not loaded: /usr/local/lib/libXYZ.dylib Referenced from: /Users/dhinz/Projects/TestCode/TestRandomFile/build/Debug/TestRandomFile Reason: image not found
If I copy the library into /usr/local/lib then the program runs without error. I'm sure there is a way to run without copying the library into /usr/local/lib but I haven't been able to figure it out from the documentation.
The library search paths look correct. Are they used for compiling and while running?
Where is this documented?
Is it possible to create a framework with the dylib and .h file?
When you create your dylib file, you have to define the install path. by default the install path is /usr/lib for a Shared library and /Library/Framework for a framework (INSTALL_PATH build setting). Then when you link an other binary to this dylib, it save this "install path" and then use it to locate you dylib. You can change the install path of a dylib and the path used to reference it in an executable by using install_name_tool If you want to use a path relative to an executable, use the @executable_path keyword in your install path. For exemple, if you want to create an executable that will use a library in the same directory, create your dylib with @executable_path/. as install name. If you want to use a path relative to a framework (that require it for example), use the @loader_path keyword.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden