问题
I just upgraded a project to VS2013 from VS2010 and now it crashes whenever I send a message via MQ, yet it worked fine under VS2010.
I suspected it was something to do with VS2013, so I built one of the demo apps that comes with MQ - imqwrld.cpp which is a simple "hello world" app.
This code alone is enough for the debug runtime library to throw an exception:
#include <imqi.hpp> // WebSphere MQ C++
int main ( int argc, char * * argv ) {
ImqQueue * p = new ImqQueue();
delete p;
return 0
}
when the ImqObject is deleted, the c rtl detects memory corruption.
I suspect it is because of DLL hell. The MQ dlls have a dependency on msvcr80.dll and my program uses a different version of the library - msvcr120d.dll.
Any suggestions on how I can solve this? I'm using MQ client 7
回答1:
Its a current release (up to and including 7.5) bug/restriction - the compiler that MQ produces its C++ libraries from, and the Visual Studio 2012+ compilers are apparently binary incompatible. You cannot solve nor workaround this other than to use the C or .NET API's depending on what you are trying to do...
As @John M Gant commented below, here is the official support page from IBM. BTW, it looks like MQ Series 8.0 is supported for C++ in VS2012
来源:https://stackoverflow.com/questions/20062808/websphere-mq-c-client-crashes-in-vs2013-library-linker-issues