Closed ShayBox closed 1 year ago
Where the dynamic libraries are searched for is dependent on the host system and is specific to it. This is documented in the libloading’s documentation.
Right, I didn't see the last paragraph of the tips section
The last example shows example.so
which in all other cases (even pkg-config) is relative to cwd, but libloading requires an explicit ./
to be relative, otherwise it only searches globally on Linux (and possibly macOS)
Reading the description of how libraries are searched by dlopen may help. In particular note that none of the steps involve searching a path relative to the binary like it is on Windows. If you would like that you might want to set the binary’s RPATH to include $ORIGIN
. Then dlopen
as a very first couple steps will look around the directory in which the binary is located.
Using a relative path doesn't seem to work on Linux, but it does on Windows
Broken:
https://github.com/ShayBox/VRC-OSC/blob/e8d81c9fc95e0ac1c9c7c036bc445ba8e95b097c/loader/src/lib.rs#L40
Fixed:
https://github.com/ShayBox/VRC-OSC/blob/015acd1f835545dfdce1ee95646d874ea2e60346/loader/src/lib.rs#L63-L68