开发者

how to unload managed c++ dll?

开发者 https://www.devze.com 2023-04-11 20:53 出处:网络
A.dll is a native c++ dll, B.dll is a managed c++ dll. A.dll depends on B.dll, so when load A.dll, B.dll is loaded automatically, but a开发者_开发问答fter A.dll is unloaded, B.dll is still loaded. Onl

A.dll is a native c++ dll, B.dll is a managed c++ dll. A.dll depends on B.dll, so when load A.dll, B.dll is loaded automatically, but a开发者_开发问答fter A.dll is unloaded, B.dll is still loaded. Only A.dll depends on B.dll, why B.dll can't be unloaded? How to unload the managed c++ dll? I'm using vs2010.

Thanks


You cannot unload a managed assembly once it is loaded by the CLR. The only way is to kill the AppDomain.


Using normal officially known approaches this is not possible without unloading AppDomain - at least for .net 4.8 framework.

Theoretically it's possible to load managed .dll as in ram, see following prototype:

https://github.com/tapika/dllloader

But even thus it's possible to release it from native side - most probably it will cause some headache to managed side.

0

精彩评论

暂无评论...
验证码 换一张
取 消