# Unload libjulia when embedding

**URL:** <https://discourse.julialang.org/t/unload-libjulia-when-embedding/10059>\
**Category:** General Usage\
**Created:** [March 29, 2018, 9:35pm UTC](https://discourse.julialang.org/t/unload-libjulia-when-embedding/10059 "2018-03-29T21:35:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![goldfita](https://avatars.discourse-cdn.com/v4/letter/g/4491bb/32.png) [@goldfita](https://discourse.julialang.org/u/goldfita)\
**Post date:** [March 29, 2018, 9:35pm UTC](https://discourse.julialang.org/t/unload-libjulia-when-embedding/10059/1 "2018-03-29T21:35:19Z")

</div>

Is libjulia.dll intentionally blocked from unloading? I find I can call FreeLibrary immediately after loading, but once I call jl\_init\_with\_image, the DLL can no longer be unloaded.

The issue I’m having is I load/process/unload within a C# thread. The second time around, I get an access violation, presumably because the DLL was never unloaded and is still hanging on to memory in the defunct thread’s stack.
