The following explains how to resolve this issue when we are using unmanged code with managed one. Especially when we got an error in _CrtIsValidHeapPointer(pUserData), we can solve this issue by putting '__DllMainCRTStartup@12' in Force Symbol Reference in the Linker section/Input.
"I had a very similar problem with one of my mixed (managed and unmanaged) projects. I was using a Winforms with /clr specified for the GUI side calling into unmanaged code that at some point referenced a ATL header. Supposedly the winforms wizard configures the project by default to skip the CRT startup code when any ATL header file is detected and thus the reason for it crashing at the g_allocator initialization (this problem is not in the console /clr version). The fix below essentially reverses what the wizard does. On a side note, I included instructions below to obtain access to MSFTs symbols for use when debugging which helped me find this one, atleast to the point I knew what to search for in Google.
Link describing the problem
Anyhow here was what I had to do: add __DllMainCRTStartup@12 in Force Symbols Reference section in the Linker section of the project settings.
VS2008 - To configure Symbol Server, open the symbol search path options dialog. (From the Tools menu, click Options. In the left pane of the Options dialog box, Open the Debugging node and click Symbols.) Add the following search path to the search list: http://msdl.microsoft.com/download/symbols. Add a symbol cache directory to the symbol server cache text box. Click OK."
Thursday, June 27, 2013
_CrtIsValidHeapPointer(pUserData) assertion when compiling with /clr
Posted by j at 8:22 AM
- ► 2016 (29)
- ► 2015 (27)
- ► 2014 (15)
- ▼ 2013 (24)
- ► 2011 (147)
- ► 2010 (170)
- ► 2009 (609)