how to load and unload dll or plugin
-
please help me unload my dll and plugin,i have a program that can load a plugin but i dont know how to unload it,they say that my loading should be different so that i can unload it.
<3:16>
-
please help me unload my dll and plugin,i have a program that can load a plugin but i dont know how to unload it,they say that my loading should be different so that i can unload it.
<3:16>
Bascially, if you didn't load the DLL into a new AppDomain, there's no way to unload the DLL.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
please help me unload my dll and plugin,i have a program that can load a plugin but i dont know how to unload it,they say that my loading should be different so that i can unload it.
<3:16>
Theres generally 2 ways of loading plugins, either into the current AppDomain or in to a new AppDomain. The only way to unload an assembly is to unload the entire AppDomain, so if you require unloading of plugins you need a new AppDomain. This doesn't come for free however as serialization has to take place on any objects passing over AppDomain boundries and so incures a performance penalty. If you load into the current AppDomain then things will run at full speed but as you have found you cannot unload the assembly. If your application rarely changes plugins or is often restarted there is very little to gain from using a seperate AppDomain. And so conversly if the app is long running (and so is vunerable to a build up of assemblies) or has a large number of plugin changes then it might be worth taking the hit to allow cleaning up of the assemblies. Personally I wouldn't bother about the unloading unless there is a real need for it ... it would be nice but it's not essential and you can always remove the plugins from use, you just can't remove them from memory. One final note, the seperate AppDomain structure does have one bug advantage when running untrusted plugins. It allows you to place a different set of security restrictions on the code and keep it away from your own code to enhance security and stability. Basically it can be used as a sandbox.
-
Bascially, if you didn't load the DLL into a new AppDomain, there's no way to unload the DLL.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007How to load DLL to AppDomain? I really don't have any idea about this,hope you could help me with this,thanks...
<3:16>
-
How to load DLL to AppDomain? I really don't have any idea about this,hope you could help me with this,thanks...
<3:16>
A little Google goes a long way[^]...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007