Boost logo

Boost :

Subject: Re: [boost] [thread] on_tls_prepare in win32\tss_pe.cpp incompatible with static linkage to a /clr object
From: Sid Sacek (ssacek_at_[hidden])
Date: 2009-04-23 21:26:57

> The C++/CLI wrappers work fine when they are dynamically linked, but
> 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