I have a dll project in Visual Studio 2012 that compiled with / MT (static multi-threaded runtime library). It also bundles a third-party static lib, also compiled with / MT (library A), without any problems.
The problem is related to another static lib (library B), which, unfortunately, is compiled with / MD. In my dll, I need to link both and there is no alternative to either of them (and I can not recompile them with the other option). I managed to successfully bind everything together, but now I have problems with allocating and deleting memory - sometimes it fails to delete the selected object, sometimes other strange errors occur. I believe this is caused by the mixed memory management functions used by different parts of my DLL - when new is called, the object is created in library B, but when delete is called, it tries to free memory with a different set of functions, but I may be wrong.
So my question is: is this really caused by mixed memory management functions? And if so, is there a way to combine this work?
The only solution I think of is to wrap the B library in another dll compiled with / MD, and then use it from the original dll to allow for the use of various memory management functions. I am not sure if this will help, and I would like to avoid it.
source share