and3rson / foreigner

FFI library for Godot, built with GDNative
MIT License
25 stars 4 forks source link

Fix file path to testlib.so so it is found. #5

Closed follower closed 4 years ago

follower commented 4 years ago

Apparently to be found in a relative directory the path needs to start with "./" otherwise system paths are searched by dlopen.

(Based on Godot source comment: https://github.com/godotengine/godot/blob/b7b39786840a41a057f531ed13b64e26366befac/drivers/unix/os_unix.cpp#L404-L408.)

Note: This may create issues on other platforms and/or on export?

and3rson commented 4 years ago

Looks good! I've just checked WinAPI docs and it should automatically convert forward slashes to backshashes (unless the path starts with \\?\)

References:

follower commented 4 years ago

Just to confirm I'm not missing something: did the non-prefixed 'testlib.so' actually work for you at one point or is it just that something else got changed at some point and the file path not get updated/tested?

(FWIW, before I fixed the path I worked around the issue via use of LD_LIBRARY_PATH.)