# Force reloading of shared C library

**URL:** https://discourse.julialang.org/t/force-reloading-of-shared-c-library/96399
**Category:** General Usage
**Tags:** ccall
**Created:** [March 21, 2023, 3:19pm UTC](https://discourse.julialang.org/t/force-reloading-of-shared-c-library/96399 "2023-03-21T15:19:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Alseidon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alseidon/32/207775_2.png) [@Alseidon](https://discourse.julialang.org/u/Alseidon)
#### Post date: [March 21, 2023, 3:19pm UTC](https://discourse.julialang.org/t/force-reloading-of-shared-c-library/96399/1 "2023-03-21T15:19:24Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![chris-b1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chris-b1/32/14165_2.png) [@chris-b1](https://discourse.julialang.org/u/chris-b1)
#### Post date: [March 21, 2023, 3:52pm UTC](https://discourse.julialang.org/t/force-reloading-of-shared-c-library/96399/2 "2023-03-21T15:52:55Z")

</div>

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](https://docs.julialang.org/en/v1/manual/calling-c-and-fortran-code/#Closing-a-Library)

---

<div class="post-metadata">

### Author: ![Alseidon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alseidon/32/207775_2.png) [@Alseidon](https://discourse.julialang.org/u/Alseidon)
#### Post date: [March 21, 2023, 4:12pm UTC](https://discourse.julialang.org/t/force-reloading-of-shared-c-library/96399/3 "2023-03-21T16:12:12Z")

</div>

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