Import : EndImport - path?

Just starting out? Need help? Post your questions and find answers here.
Lebostein
Addict
Addict
Posts: 829
Joined: Fri Jun 11, 2004 7:07 am

Import : EndImport - path?

Post by Lebostein »

Hi,

to import a dylib on mac, the code works if the dylib is in the same directory as the pb-file.
If I compile this pb to an app, in which subdirectory I have to copy the dylib?

Thanks.
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Import : EndImport - path?

Post by Danilo »

Lebostein wrote:to import a dylib on mac, the code works if the dylib is in the same directory as the pb-file.
If I compile this pb to an app, in which subdirectory I have to copy the dylib?
  • Copy the dylib into "YourAppName.App/Contents/MacOS/"
    or into a subdirectory within this folder, for example "YourAppName.App/Contents/MacOS/lib/"
  • Now run the command:

    Code: Select all

    install_name_tool -change YourDylibName.dylib @executable_path/YourDylibName.dylib ./YourAppName.App/Contents/MacOS/YourAppName
    If you installed into lib/ subdirectory, you write

    Code: Select all

    install_name_tool -change YourDylibName.dylib @executable_path/lib/YourDylibName.dylib ./YourAppName.App/Contents/MacOS/YourAppName
    (replace "YourAppName" and "YourDylibName" with your own names. Do not replace "@executable_path", it is written like that)
  • Verify the changed dylib path by running:

    Code: Select all

    otool -L ./YourAppName.App/Contents/MacOS/YourAppName
    It should output "@executable_path/" in front of your dylib name, whereas before the change it just displayed the dylib name without a path
Lebostein
Addict
Addict
Posts: 829
Joined: Fri Jun 11, 2004 7:07 am

Re: Import : EndImport - path?

Post by Lebostein »

Thank you! I will try it.
Post Reply