I have a C# class that I've made ComVisible so that it can be used in an unmanaged C++ DLL. The C# class is defined like this:
public interface IFSFunction
{
double GetProcessTime();
}
public class Functions : IFSFunction
{
// Initialization here
// Interface function
public double GetProcessTime()
{
// Do stuff - return a value
}
}
Then, in my C++ DLL I get a reference to the C# class like this:
IFSFunctionPtr pIFuncs;
pIFuncs.CreateInstance(__uuidof(Functions));
double proctime = pIFuncs->GetProcessTime()
pIFuncs.Detach()->Release();
This calls the C# functions very nicely, but it doesn't seem to clean up correctly afterwords. There still seems to be a reference to my C# class hanging around. How can I make sure that my C# COM object is completely gone?