Reputation: 2502
I have the following code in a C++ DLL. It loads and invokes a method in a DotNet DLL built with C#.
Assembly^ a = Assembly::LoadFrom(gcnew String("MyDotNet.dll"));
Type^ type = a->GetType("MyAssemply.Assembly");
MethodInfo^ method = type->GetMethod("MyMethod");
Object^ obj = Activator::CreateInstance(type);
array<Object^>^ params = gcnew array<Object^>(0) { };
Object^ ret = method->Invoke(obj, params);
The problem is that it does not appear to release the resources or DLL even when I do a FreeLibrary on the C++ DLL. Is there a API or Method I need to call to release the DLLs/resources?
I am using Visual Studio 2010.
Thanks.
Upvotes: 0
Views: 132
Reputation: 190945
You can't unload a managed assembly from an app pool. You can create another app pool and unload that.
This post is related: How to unload an assembly from the primary AppDomain?
Upvotes: 1