Force reloading of shared C library

Hi,

I am calling a C function, compiled with gcc -shared -fPIC as it should be. Until then, no problem; however, if I modify and compile the C code again, the changes won’t appear in Julia. I tested this by going in the REPL and:

  • defining and calling the function f_a which contains a ccall to the .so file;
  • removing the .so file;
  • defining and calling a second function f_b with the same call to the .so file.
    Do I have to restart the Julia kernel to take the modifications into account?

I think the instructions in the docs here should cover your use case - using Libdl to explicitly open/close the library.
https://docs.julialang.org/en/v1/manual/calling-c-and-fortran-code/#Closing-a-Library

1 Like

I should have read the doc more carefully… This is indeed what I was looking for!