在.net调用C++/CLI 编写的InterOP程序时,如果这个InterOP程序中使用了Boost.thread,那么很可能出现下面的问题:
异常System.BadImageFormatException : is not a valid Win32 application
解决方案:
1. Use the DLL version of boost::threads with the following line before including any boost/thread files
#define BOOST_THREAD_USE_DLL
2. Sometimes the following could help:
#pragma unmanaged
#include <boost/thread.hpp>
#pragma managed
其中,1方法验证通过,2方法似乎无用。