[Insight-users] ITK and managed c++ 2005

Tadeusz Dracz tdracz at o2.pl
Sun Oct 1 06:33:06 EDT 2006


[I apologize for resending it, but the message text was removed by the
mailing list somehow in the previous post]

Hi Dan, 
 
Do you use managed windows forms C++ application? Because my C++ managed
console applications run ok with ITK. If you do, there would be at least
some hope for me that it is possible.
 
I have attached the simplest managed windows forms C++ application. I have
removed all additional files and code, to keep it down to minimum. From the
standard settings I have changed from /clr:pure to /clr (Configuration
Properties->General->Common Language Runtime Support), otherwise ITK would
not link.
 
Before, I have compiled ITK using standard settings (BUILD_SHARED_LIBS is
OFF).
 
There is a workaround that will make it run. This requires changing:
Linker->System->Subsystem: Not Set
Linker->Advanced->Entry Point: Empty
 
But this trick causes a console window to appear and this is supposed to be
a Windows Forms application. 
This will look all right in the attached sample, because I have removed the
form creation code, but it does not look pretty in the real application
where both the console window and the form show up.
 
Best, 
Tadeusz 

________________________________

From: Dan Mueller [mailto:d.mueller at qut.edu.au] 
Sent: Saturday, September 30, 2006 11:14 PM
To: tdracz at o2.pl
Cc: insight-users at itk.org
Subject: Re: [Insight-users] ITK and managed c++ 2005


Hi Tadeusz,

I have been using ITK with C++/CLI with no problems... I have experienced
some "access violation exceptions" similar to yours below - but only when
using a SmartPointer which has gone out of scope and deleted itself.

Can you provide some more information, or perhaps a minimal example which
fails?

Cheers

Dan

tdracz at o2.pl wrote: 

	Hello,
	
	I have created a sample C++ managed windows forms application that
is
	supposed to use ITK.
	I have added all includes as in a normal unmanaged c++ project. It
compiles
	without errors and warnings. 
	But when executed, it throws an exception just at the start. Here is
the
	contents of the Output window:
	
	First-chance exception at 0x7c96cc82 in App.exe: 0xC0000005: Access
	violation reading location 0x0d7cebd9.
	First-chance exception at 0x781389db (msvcr80.dll) in App.exe:
0xC0000005:
	Access violation writing location 0x0d7cebda.
	A first chance exception of type 'System.AccessViolationException'
occurred
	in App.exe
	A first chance exception of type
	'<CrtImplementationDetails>.ModuleLoadException' occurred in
msvcm80.dll
	First-chance exception at 0x7c812a5b in App.exe: Microsoft C++
exception:
	[rethrow] at memory location 0x00000000..
	An unhandled exception of type 'System.TypeInitializationException'
occurred
	in Unknown Module.
	Additional information: The type initializer for '<Module>' threw an
	exception.
	System.TypeInitializationException' occurred in Unknown Module.
	
	
	The application contains just these lines that use ITK:
	
	#include "itkImageFileReader.h"
	typedef unsigned short PixelType;
	const unsigned int Dimension = 3;
	typedef itk::Image< PixelType, Dimension > ImageType;
	
	Is there anybody that could help in this matter?
	
	Regards, 
	Tadeusz
	
	_______________________________________________
	Insight-users mailing list
	Insight-users at itk.org
	http://www.itk.org/mailman/listinfo/insight-users
	  



More information about the Insight-users mailing list