例外HRESULT:执行C#应用程序中引用本地C ++与升压LIB时0x800700C1 [英] exception HRESULT: 0x800700C1 when executing c# application referencing native c++ lib with boost

查看:121
本文介绍了例外HRESULT:执行C#应用程序中引用本地C ++与升压LIB时0x800700C1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行C#应用程序引用了C ++ \\ CLI包装项目反过来引用本地C ++项目依赖于升压1.47库(链接的形式... VC100-MT-GD-1_47.lib的文件)

I am running a C# application that references a C++\CLI wrapper project which in turn references a native c++ project dependent on Boost 1.47 library (links to files of the form ...vc100-mt-gd-1_47.lib)

所有的库静态链接,一切伟大的编译。执行一个异常的C#应用​​程序的结果:
......是不是有效的Win32应用程序(从HRESULT异常:0x800700C1)。自称一些依赖丢失的地方。

All libraries are statically linked and everything compiles great. Executing the C# app results in an exception: "...is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)." claiming some dependency is missing somewhere.

C#应用程序配置为x86平台,而所有其他项目的Win32,包括升压转换器的二进制文件。

C# application is configured to x86 platform while all other projects are Win32, including boost's binaries.

编辑:添加使用Boost库之前,它的工作

before adding the use of Boost library, it DID work

我如何追查问题?

推荐答案

这是已知的问题。究其原因是线程在升压::线程使用本地存储(TLS)。要解决它,你应当禁止libboost_thread-vcXXX-MT-1_XX.lib和部队链接到你的C ++ / CLI装配与链接boost_thread-vcXXX-MT-1_XX.lib(该boost_thread-vcXXX-MT-1_XX.dll的存根)

It is known issue. The reason is Thread Local Storage (TLS) used in the Boost::Thread. To fix it you should either disable libboost_thread-vcXXX-mt-1_XX.lib and force linker to link your C++/CLI assembly with boost_thread-vcXXX-mt-1_XX.lib (stub of the boost_thread-vcXXX-mt-1_XX.dll).

或者你可以创建自己的DLL和libboost_thread-vcXXX-MT-1_XX.lib链接。然后,你可以用C ++ / CLI集链接你的C ++ DLL。

Or you can create your own DLL and link it with libboost_thread-vcXXX-mt-1_XX.lib. Then you can link your C++ DLL with C++/CLI assembly.

请参阅

  • Using boost threads when compiling with /clr
  • Boost Threads with CLR
  • Using boost in CLR

这篇关于例外HRESULT:执行C#应用程序中引用本地C ++与升压LIB时0x800700C1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆