开发者

Does @rpath work for looking up .dylibs that are loaded/called from another .dylib?

开发者 https://www.devze.com 2023-03-21 07:41 出处:网络
I just found about the @rpath to load .dylib files using dlopen, and need some help understanding them.I am using Xcode 3.2.5 on a OSX machine.

I just found about the @rpath to load .dylib files using dlopen, and need some help understanding them. I am using Xcode 3.2.5 on a OSX machine.

I have several .dylib's that call other .dylib's, and which also call each other. The @rpath seems to work for the initial .dylib that is loaded, but on开发者_开发百科ce I make a dlopen call with another .dylib that uses the first .dyblib file that was previously found and loaded using @rpath, dlopen will fail saying that it can't locate the original .dylib.

Does @rpath only work for file the being used with dlopen, or is it also being used to resolve dependencies inside of the dylib file being opened?

UPDATE:

My further findings is leading me to use install_name_tools to change the inter-dependencies to have a @rpath to them. Is this the correct way of doing this?


After days of research and trial and error, I found out that I needed to do an -install_name on all my .dylibs with @rpath/dylibName.dylib as the install name for all libraries that I intend to use a relative path to find.

0

精彩评论

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

关注公众号