
I realize it is not officially supported, but has anyone had success using boost libraries in a mixed CLR assembly? I am using visual studio 2005. I have been trying to accomplish this in an applicatation that has a Windows Forms front end, whose enire back end is build of libraries written in standard C++, making extensive use of boost, especially smart pointers and threads. The specific problem I am having involved initializing static variables. For instance, I have a global variable: boost::mutex osmutex; The program compiles and links fine, but during static initialization, I receive an error indicating _CrtIsValidHeapPointer(pUserData) is invalid. Looking at the stack unwind, the calling code is the "dynamic initializer for 'osmutex'". My suspicion is that the boost library is linking to a different run time library than my mixed code, and that the pointer being rejected is happening as a result of it coming from a different heap. I would like try to check this hypothesis by building boost forcing it to link to the correct C++ runtime library used by mixed assemblies (msvcmrtd.dll), but I am not familar enough with the boost build system to do this.