Click here to Skip to main content
12,759,875 members (31,054 online)
Rate this:
Please Sign up or sign in to vote.
See more: C++
I have developed a class library that wraps an existing unmanaged class library. All of this is done under Visual C++ 2005 (after realizing that it is virtually impossible under VC 2003).

I am trying to use the wrapper classes in a simple Forms application. In the debug mode, I am getting a _CrtIsValidHeapPointer assertion before any of my code is invoked. To ease troubleshooting, the debugger does not breakpoint nor provide any Call Stack information.

I have made sure that the Runtime Libraries options are compatible between all projects (Multithreaded Debug DLL).

Any suggestion ?
Posted 15-Jul-11 8:30am
Updated 8-Jan-13 2:28am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You migth try statically linked run-time instead of dynamic. You have to check some other options like pointer alignment and such. Some options might be fundamentally incompatible between .NET options and C++ run-time...

Compare default options of a new projects of each types (that is options for an unmanaged libraries and options for a .NET application (or library).

Does the release version seems to works.

You might also consider to post the list of options you have modified in either project and the list of options that are different between an unmanaged class library and and a managed one.
YDaoust 16-Jul-11 9:45am
Thank you for the suggestions.

Statically linking to RTL is not possible for mixed-mode assemblies.

I will now throughly compare the options in the projects (most of the time I stick to the default ones).
YDaoust 16-Jul-11 14:59pm
Then native project was compiled with /noclr while the wrapper was /clr. Setting both projects to /clr does the trick.

Thanks again for helping.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I also got same exception and got good answer here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170217.1 | Last Updated 8 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100