The problem is that boost.thread uses some #pragma section
directives that are incompatible when built without /clr then statically linked to code that uses /clr.
I've heard that rebuilding boost.thread with /clr (i.e., pass cxxflags="/clr"
when invoking bjam) fixes the issue, but I haven't tried it personally.
I assume that dynamically linking to boost.thread (rather than statically, which is the default for VC++; #define BOOST_THREAD_DYN_LINK
before including any boost headers) should work too, but again, I haven't tried it.
If that doesn't work, try googling for some combination of boost
thread
clr
tls
; you should find quite a few posts on the boost mailing list about it, as this is an old problem.
EDIT: As commented here by Raman Sharma (a senior PM at Microsoft), even std::mutex
isn't supported with /clr, so it's no real surprise that boost.thread's mutex implementation isn't either.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…