None of the existing answers are correct: given the following on Windows: you have two DLLs, each of them is statically linked to two different versions of the standard C / C ++ libraries.
In this case, you should not pass pointers to structures created by the standard C / C ++ library in one DLL, in another. The reason is that these structures may be different between the two standard implementations of the C / C ++ library.
Another thing you do not need to do is a free pointer allocated by the new or malloc from one DLL that has been allocated to another. A different heap implementation may also be implemented.
Note. You can use pointers between DLLs - they just point to memory. This is freedom in this.
Now you may find that it works, but if so, then you are just lucky. This is likely to cause problems in the future.
One possible solution to your problem is dynamic linking with CRT . For example, you can dynamically bind to MSVCRT.DLL. Thus, your DLL will always use the same CRT.
Note. I recommend that you fail to transfer CRT data structures between DLLs. You might want to know if you can improve the situation.
Please note that I am not an expert on Linux / Unix, but you will have the same problems for these OSs.
Foredecker
source share