Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

freeman-1387

macrumors newbie
Original poster
Jan 17, 2011
6
0
Hi.
I am create ScreenSaver for mac, and it work.
But I need to use additional dynamic library, and after attach library my screenSaver crashed after start:

Library not loaded: @executable_path/my.dylib
Referenced from: (path to screensaver)/Contents/MacOS/(Project Name)
Reason: image not found

how can I download the library from my *.saver/Contents/MacOS/

thanks.
 
If you are using a library that is not shipped with OS X, then make sure you create a copy files build phase and add the library to that build phase.
 
If you are using a library that is not shipped with OS X, then make sure you create a copy files build phase and add the library to that build phase.

my *.dylib alredy existing in my.saver/Contents/MacOS/*.dylib

my.saver is a plug-in which runs a special ScreensaverEngine.app and therefore the working directory is not my.saver/Contents/MacOS/

working Dir with start is: ScreensaverEngine.app/Contents/MacOS/

----
MSVisual C++ has a Delay-Load-DLL. can I make such a XCode?
 
MSVisual C++ has a Delay-Load-DLL. can I make such a XCode?

I am find this. This is a Weak Link option for some libraries.
Now the question is how to load the library.
I use dlopen, but this not worked. Program crashed.
(how to do that did not have to take a pointer to every function used in the library?)
 
I've never used a dynamic library in my apps before, but as far as I know you will have to set an install name for the library. Try this when compiling the library:
Code:
gcc <the usual stuff> -install_name @executable_path/my.dylib

Hope that helps

Edit: You shouldn't need the dlopen
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.