exception HRESULT: 0x800700C1 when executing c# application referencing native c++ lib with boost

12

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)

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# application is configured to x86 platform while all other projects are Win32, including boost's binaries.

EDIT: before adding the use of Boost library, it DID work

How can I track down the problem?

visual-studio-2010
boost
c++-cli
asked on Stack Overflow Nov 11, 2011 by Leo • edited Nov 11, 2011 by Leo

2 Answers

1

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).

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.

See

answered on Stack Overflow May 4, 2014 by Dmytro Ovdiienko • edited May 23, 2017 by Community
0

Came across this nasty error the other day whilst trying to get an IIS app running on my Visat 64bit PC:

Error: Is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)

Solution:

Within IIS 7 click on Application Pools (left hand side under {machine_name}) Select your app pool and then click Advanced Settings on the right. Second setting in the list: Enable 32-Bit Applications - must be set to True.

answered on Stack Overflow Jul 3, 2014 by Raj Kumar

User contributions licensed under CC BY-SA 3.0