Boost logo

Boost Users :

Subject: [Boost-users] Fatal runtime error when using Boost in a native static library referenced by a mixed dll
From: Dario Ramos (dario_ramos_at_[hidden])
Date: 2014-02-19 09:18:07


I refactored a native C++ static library to use boost::thread and
boost::asio instead of the Windows API. This static library is referenced
by a C++/CLI dll built with the /clr switch; it acts as a wrapper for the
managed upper layers to use.

I use Boost inside native C++ dlls referenced by C++/CLI dlls and that
works fine, but this particular scenario is a first. I suspect that Boost
and C++/CLI don't play nice together, since I had to be careful to use the
PIMPL idiom to avoid boost headers from being indirectly included in
C++/CLI code. But now that I have to forcibly link a Boost lib with my
C++/CLI dll, things have gone awry. Is this a supported usage for Boost?

My environment: Boost 1.53.0, Visual Studio Professional 2012 Version
11.0.61030.00 Update 4, Windows 7 x64.

The error is an EEFileLoadException in KernelBase.dll. It happens right
after my C++/CLI dll is loaded into memory. Here's the callstack:

> KernelBase.dll!_RaiseException_at_16() + 0x58 bytes
  msvcr110_clr0400.dll!__CxxThrowException_at_8() + 0x3e bytes
  clrjit.dll!Compiler::impResolveToken() + 0x3a bytes
  clrjit.dll!Compiler::impImportBlockCode() + 0x10d5 bytes
  clrjit.dll!Compiler::impImportBlock() + 0x55 bytes
  clrjit.dll!Compiler::impImport() + 0x167 bytes
  clrjit.dll!Compiler::compCompile() + 0x47 bytes
  clrjit.dll!Compiler::compCompileHelper() + 0x1f0 bytes
  clrjit.dll!Compiler::compCompile() + 0x104 bytes
  clrjit.dll!jitNativeCode() - 0x11eb bytes
  clrjit.dll!CILJit::compileMethod() + 0x25 bytes
  [External Code]
  mscoreei.dll!__CorExeMain_at_0() + 0x71 bytes
  mscoree.dll!_ShellShim__CorExeMain_at_0() + 0x227 bytes
  mscoree.dll!__CorExeMain_Exported_at_0() + 0x8 bytes
  ntdll.dll!___RtlUserThreadStart_at_8() + 0x27 bytes
  ntdll.dll!__RtlUserThreadStart_at_8() + 0x1b bytes

-- 
*Darío Eduardo Ramos*
Meditech S.A. www.meditech.com.ar
(+54) 01147603300, Interno 31
Av. Julio A. Roca 3456
Florida Oeste, Bs.As. Argentina


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net