I have a DLL that's written in C++Builder (2006), and I'm invoking a single function in the DLL from a .NET application.
The problem is, when I close the .NET application (and the DLL gets detached from it) I get a CodeGuard error saying that it detected resource leaks (and I see the leaks in the CodeGuard log file). I also see the LoaderLock MDA pop up in Visual Studio when freeing the DLL (probably for the same reason?).
Now, I'm 99% certain that I'm freeing all the memory I'm using in the DLL function. In fact, I tried building a dummy DLL with an identically-named function that does absolutely nothing, and still got resource leaks when the DLL is unloaded from the .NET application.
My only suspicion at this point is the fact that I'm using VCL built into the DLL. Is there some uninitialization function that I need to call explicitly when detaching from the DLL? What could be going on?
p.s. The memory addresses from the call stack given in the CodeGuard log file seem to be well beyond anything I see in my Map file.