Boost logo

Boost :

Subject: Re: [boost] [thread] on_tls_prepare in win32\tss_pe.cpp incompatible with static linkage to a /clr object
From: Matthew Chambers (matthew.chambers_at_[hidden])
Date: 2009-05-06 18:20:05

Hi Sid,

I tried what you said to get around the 0xc000007b error by building
boost with /clr, but that didn't work for me. It's also a pretty heavy
solution (requiring all of boost to be managed) when my alternative
seems to work fine (allowing to disable the on_tls_prepare
initialization function).


Sid Sacek wrote:
>> The C++/CLI wrappers work fine when they are dynamically linked, but
> they
>> cause a runtime initialization error (0xc000007b) whenever they are
>> connected in only static links.
> I had a similar problem when I tried to use boost within a CLR program.
> When I rebuilt the boost libraries with the /CLR option, the problem
> went away.
> There is a thunking layer that takes place between managed and unmanaged
> code. If you statically link managed code with unmanaged code, the link
> will take place just fine and fool you into believing the program is
> going to run.
> But at runtime, the CLI tries to load and link the pieces of the code
> together, and when it fails, it aborts with the 0xC000007b error.
> Building the boost libraries with the /CLR option makes boost
> managed-code as well.
> You may want to have two sets of boost libraries. One set for C++
> applications, and another set for CLI applications.
> -Sid Sacek

Boost list run by bdawes at, gregod at, cpdaniel at, john at