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.