Boost logo

Boost Users :

Subject: Re: [Boost-users] VS2010 and /clr: fatal error C1001: An internal error has occurred in the compiler
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-08-07 20:03:28


On Sat, Aug 7, 2010 at 9:47 AM, Soren Dreijer
<admin_at_[hidden]> wrote:
> I recently switched our product over to VS2010 from VS2008. Our solution
> consists of several native C++ projects and some managed C++ projects that
> link to those native projects.
>
> The managed C++ projects are compiled with the /clr flag, of course.
> However, when compiling for x64, one of the files that includes one of the
> boost mutex headers causes the compiler to spit out the following error:
>
> boost_1_43_0_sdk\include\boost\thread\win32\basic_timed_mutex.hpp(158):
> fatal error C1001: An internal error has occurred in the compiler
>
> I've traced down the problem to the following piece of code in
> basic_timed_mutex.hpp:
>
> void unlock()
> {
>     long const offset=lock_flag_value;
>
>     // If I comment out this line, compilation works
>     long const
> old_count=BOOST_INTERLOCKED_EXCHANGE_ADD(&active_count,lock_flag_value);
>
>     if(!(old_count&event_set_flag_value) && (old_count>offset))
>     {
>
> if(!win32::interlocked_bit_test_and_set(&active_count,event_set_flag_bit))
>         {
>             win32::SetEvent(get_event());
>         }
>     }
> }
>
> It would see the BOOST_INTERLOCKED_EXCHANGE_ADD macro causes the compiler to
> barf. Does anybody have any ideas on why this is, or how to fix it?

Probably because that causes some assembly to be emitted because of
the efficiency requirements of the mutex, and the CLR does not support
direct assembly. Either get out of the CLR, or do not use anything
that uses low assembly constructs (CLR has its own thread and mutex
classes anyway).


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