If you were calling
ccall((:my_fcn, "./my_lib.so"), ...)
but needed to close the library when done, then do this instead:
lib = Libdl.dlopen("./my_lib.so")
sym = Libdl.dlsym(lib, :my_fcn)
ccall(sym, ...) # Remaining arguments are the same.
Libdl.dlclose(lib)
More on the GitHub issue: https://github.com/JuliaLang/julia/issues/23459