开发者

Set path to .dylib path in Cocoa app

开发者 https://www.devze.com 2022-12-22 04:42 出处:网络
I\'m developing a Mac OS X Cocoa app and want to use several .dylib libraries. How do I set the path to a .dylib which re开发者_运维技巧sides somewhere in my Application folder? What if the path resid

I'm developing a Mac OS X Cocoa app and want to use several .dylib libraries. How do I set the path to a .dylib which re开发者_运维技巧sides somewhere in my Application folder? What if the path resides in different directories on different computers or is not existent at all?


which resides somewhere in my Application folder?

Use @rpath. (or @executable_path.) See man 1 dyld.

What if the path resides in different directories on different computers or is not existent at all?

Then your app will fail to load. Use weak linking or load the dylib at runtime with dlopen if the dylib is not essential.

0

精彩评论

暂无评论...
验证码 换一张
取 消