Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dlopen errors with relative path

Tags:

c++

macos

dlopen

I am trying to call a .dylib file from another .dylib file. They are in the same folder. I do this:

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

But handle winds up NULL and dlerror() says it can't find it. 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?

like image 435
Garth Hjelte Avatar asked Oct 29 '25 08:10

Garth Hjelte


1 Answers

A relative path is relative to your current working directory - not to the location of your first dylib

like image 186
Erik Avatar answered Oct 31 '25 00:10

Erik