Use *.dylib from ScreeSaver?

Discussion in 'Mac Programming' started by freeman-1387, Jan 17, 2011.

  1. freeman-1387 macrumors newbie

    Joined:
    Jan 17, 2011
    #1
    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.
     
  2. misee macrumors member

    Joined:
    Jul 4, 2010
    #2
    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.
     
  3. freeman-1387 thread starter macrumors newbie

    Joined:
    Jan 17, 2011
    #3
    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?
     
  4. freeman-1387 thread starter macrumors newbie

    Joined:
    Jan 17, 2011
    #4
    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?)
     
  5. misee, Jan 17, 2011
    Last edited: Jan 17, 2011

    misee macrumors member

    Joined:
    Jul 4, 2010
    #5
    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
     

Share This Page