C++/CLI InteOP with Boost.thread

来源:互联网 发布:http请求没有返回数据 编辑:程序博客网 时间:2024/06/08 05:53
 
在.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方法似乎无用。

原创粉丝点击