Putting libraries on swipl's equivalent of LD_LIBRARY_PATH
The "foreign/1" tag indicates in what directories to look for foreign libraries. It is configured (as usual) through file_search_path/2:
On my machine,
foreign means look in these:
?- file_search_path(foreign,X). X = swi('lib/x86_64-linux') ; X = swi(lib) ; false.
swi means look in these:
?- file_search_path(swi,X). X = '/usr/local/logic/swipl/lib/swipl' ; false.
Once you have compiled an .so file, make it discoverable by swipl using
After that, one can load the Prolog file of the module as usual. By consulting directly or be using use_module/2
Using the environment variable
LD_LIBRARY_PATH does nothing.