gcroot constructor crash
-
Hey there! I'm writing a DLL as a plugin for an unmanaged piece of software, the DLL exports a struct with basic information such as name etc. There is no problem with this, it works well, other than a couple of compiler warnings that I wont go into just yet. In my plugin, I want to use a managed class (__gc). I declare it as global like this:
gcroot Omg;
Here is the class definition:public __gc class COmg { public: COmg( void ) {} ~COmg( void ) {} };
This still compiles and loads fine, until I try and use my gcroot'ed class:Omg = new COmg;
It dies at this line, as far as I know im linking with the .NET framework fine, because everything compiles and runs, and i've done similar projects to this in the past. I tried calling this in try/catch braces but it doesn't help. I'd appreciate any help! Thanks. P.S. Here are the compiler warnings that may be contributing to this?MSVCRT.lib(checkclr.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators MSVCRT.lib(secchk.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators Core.obj : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators