Libdl.DL_LOAD_PATH

Hi Julia community,

I am rewriting my code to move from Julia 0.6x to 1.0 and I stumbled over a little problem and could not find out how to solve it.

I am loading one of my modules ‘MyMod’ and inside one of the module’s functions I have a ‘ccall(…)’ to library ‘mylib’. The library ‘mylib’ is in ‘/path2MyMod/lib/mylib.so’.

Now, when I am at the REPL and type append the path with ‘push!(Libdl.DL_LOAD_PATH, “/home/username/Code/path2MyMod/lib”)’ and then call MyMod.functionCCALL(…) everything works fine.

If I append the path within the module (instead of global scope in the REPL) I get an error: Julia tells me that it does not know the library once functionCCALL(…) is called.

My goal is to append to DL_LOAD_PATH the absolute library path once the module is imported.

Is there such an option?

Best,
Konrad

I would like to add

OK, I fixed it myself by simply loading a library pointer using relative paths with ‘Libdl.dlopen()’, then relevant symbols with ‘Libdl.dlsym()’ and then passed these to ‘ccall()’.

This works fine but if there is an idea of how to do it by appending the path to DL_LOAD_PATH once the module is loaded I would be happy to hear your opinion :slight_smile:

Cheers,
Konrad

1 Like