Exception when accessing static object inside a native .lib, from a managed c++ app


so, here's scenario. have native c++ static library. exposes function contains static object (with destructor). have managed c++ application (compiled /clr). when call library function, exception thrown when object's destructor registered 'atexit' runtime library function (this has been injected compiler object's destructor can called when application finishes).

 

i have made simple vs2005 solution demonstrates problem - can download here:

http://www.megafileupload.com/en/file/59468/threadingerror-zip.html

(you'll have wait 30 seconds before can download file - sorry in advance popups)

 

any appreciated cannot figure out how fix this. @ first thought threading error (hence name of solution) calls 'atexit' called same thread, i'm starting think there might else causing this...

 

thanks,

 

james bird

 

 

the linker options chose prevent crt initializing properly.  doesn't execute proper startup code initializes atexit() infrastructure, thinks running dll instead of exe.  correct, set linker + system + subsystem console , set linker + advanced + entry point empty string.  last step got in trouble when tried rid of linker error.


.NET Framework  >  Common Language Runtime Internals and Architecture



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'