I am writing a module Foo, which depends on ccalling some code in another part of my source tree. In my module, I push!(Libdl.DL_LOAD_PATH, "path/to/file"), and I’m able to find the .so according to some debugging.
However, outside of the module, after using Foo, Libdl.DL_LOAD_PATH is empty, and during compilation, the functions inside of Foo can’t find the requisite .so. Without the using/module barrier, everything seems okay (running lines from the REPL).
I can also successfully load the library if, after using Foo, I push! the right path again.
What’s going on? How can I fix this? An MWE seems hard to provide because it requires setting up a dev package and I’m not too familiar with the packaging system, but I can try.
Maybe you can define __init__ function for your module to push! the path and execute any other initialization steps at the runtime. Search __init__ on https://docs.julialang.org/en/v1/manual/modules/# to see explanations and examples.
This solved my problem perfectly. Thanks so much for the pointer! I suppose I was confused about the difference between what happens at compile time and what happens at runtime, and this clarified the split perfectly.