简体   繁体   English

用相对路径dlopen错误

[英]dlopen errors with relative path

I am trying to call a .dylib file from another .dylib file. 我试图从另一个.dylib文件调用.dylib文件。 They are in the same folder. 它们位于同一个文件夹中。 I do this: 我这样做:

void* handle = dlopen("./other.dylib", RTLD_LAZY); void * handle = dlopen(“./ other.dylib”,RTLD_LAZY);

But handle winds up NULL and dlerror() says it can't find it. 但处理结束NULL和dlerror()说它无法找到它。 However, if I use a absolute path, it works. 但是,如果我使用绝对路径,它就可以工作。 The docs say I can use a relative path. 文档说我可以使用相对路径。 I am sure my spelling and case are correct. 我确信我的拼写和案例是正确的。

Why does it error? 为什么会出错?

相对路径是相对于当前工作目录的 - 而不是相对于第一个dylib的位置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM