[Insight-users] _crtisvalidheappointer problem with managed unmanaged code mixed

Thomas Lambertz thomas at hexerei-software.de
Wed Mar 8 20:02:40 EST 2006


Hello there,

i am relativly new to itk/vtk so my problem may hopefully be a newby one ...

I used Visual Studio Prof. 2005 for building some of the itk/vtk 
examples without problems. For building the solution files cmakes works 
fine.

But - for some reasons - i decided to develop the GUI as C++ managed 
Code and problems startet. As i understand cmake cannot create managed 
projects so i created a new windows forms one and tried to include the 
necessary itk/vtk code by hand.

First try was to include some headers to see what happens:

I put into the code:
#pragma unmanaged
#include "itkImage.h"
#pragma managed

It compiled succesful and run without problems (ok there is no real 
functionality in it - but after reading some of the archivmails it makes 
me happy at this point)

So next step was:
#pragma unmanaged
#include "itkImage.h"
#include "itkImageFileReader.h"
#pragma managed

And things changes. Compiler an Linker succeded without errors - but 
starting this little projekt ended up really soon with this error message

Debug Assertion Failed!
Program: C:\tries\test.exe
File: dbgheap.c
Line: 1414

Expression: _CRTIsValidHeapPointer(pUserData)

I searched for some explanation and found, that this often happened when 
not Multithreaded Debug Dlls were used - but that´s not the case.

My idea is that this may belong to the boxing between managed and 
unmanaged code as they have different heaps.


So after spamming you with all the information my question is:

Is there a general problem by mixing unmanaged itk/vtk code with managed 
GUI ? Is the way i´ve done it problamaticly ? What is the missing link 
to my problem ?

I hope someone can give me the hints i need to solve the problem.

Thanks in advanced und king regards,
Tom




More information about the Insight-users mailing list