Generally speaking, you won't be able to use a C++ DLL built with one compiler from a program built with another one. Name mangling is just one of the issues - there is no compatibility guarantee for exception handling, RTTI, memory management or even the class layout itself (especially for multiple and virtual inheritance), to name just a few potential problems.
Some suggestions (none of them ideal):
- The best solution is if you can sidestep the original problem completely and either obtain binaries for your compiler or build from source code (i.e. build both DLL and its client from MinGW in your case).
- If you can expose the DLL's interface as pure C API, do it. E.g. Win32 is "C API" and works quite well with all kinds of compilers, and not just C/C++.
- If you want "object oriented" API for your DLL, don't need portability and are prepared to invest a necessary development effort, providing a COM API might be worth a look.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…