<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
Bill and others,<BR>
&nbsp;<BR>
I have found my mistake. I was asking VC++ to compile the code in release mode and it was using the Multithreaded DLL libraries instead of the Multithreaded-Debug DLL libraries (under&nbsp;Project-&gt;Settings-&gt;C/C++-&gt;Code Generation) which ITK uses. The two runtime libraries were conflicting. I did not catch this before most likely because I am a C++ newbie and do not know much about the intricacies of compiling code. So I thought I would post this "solution" should someone else run into the same problem. Thanks. <BR>
<BR>Vik<BR>
<BR><BR>&gt; Date: Sat, 9 Aug 2008 19:35:56 -0400<BR>&gt; From: bill.lorensen@gmail.com<BR>&gt; To: vikmonster@hotmail.com<BR>&gt; Subject: Re: [Insight-users] Example code crashes when compiled in release mode<BR>&gt; CC: insight-users@itk.org<BR>&gt; <BR>&gt; Vikren,<BR>&gt; <BR>&gt; FYI, debug mode can be 5-30 times slower. I'm not sure why your code<BR>&gt; is crashing though. What is the full command line that your are<BR>&gt; executing?<BR>&gt; <BR>&gt; Bill<BR>&gt; <BR>&gt; On Sat, Aug 9, 2008 at 4:27 PM, Vikren Sarkar &lt;vikmonster@hotmail.com&gt; wrote:<BR>&gt; &gt; Good afternoon,<BR>&gt; &gt;<BR>&gt; &gt; I am using Visual C++ 2008 Express to try to compile some of the example<BR>&gt; &gt; code from ITK. I took the imageregistration8.cxx code as is with no<BR>&gt; &gt; modification whatsoever except for renaming it to RR.cxx, and used the<BR>&gt; &gt; following cmake file to create a project:<BR>&gt; &gt;<BR>&gt; &gt; cmake_minimum_required(VERSION 2.4)<BR>&gt; &gt; # This project is designed to be built outside the Insight source tree.<BR>&gt; &gt; PROJECT(RR)<BR>&gt; &gt; # Find ITK.<BR>&gt; &gt; FIND_PACKAGE(ITK REQUIRED)<BR>&gt; &gt; IF(ITK_FOUND)<BR>&gt; &gt; INCLUDE(${ITK_USE_FILE})<BR>&gt; &gt; ENDIF(ITK_FOUND)<BR>&gt; &gt; ADD_EXECUTABLE(RR RR.cxx )<BR>&gt; &gt; TARGET_LINK_LIBRARIES(RR ITKIO ITKNumerics ITKStatistics)<BR>&gt; &gt;<BR>&gt; &gt; When I build the project in debug mode, everything works except that a<BR>&gt; &gt; single iteration with the example files takes about 2 minutes (on an AMD<BR>&gt; &gt; Turion x2 at 1.9 GHz with 2 GB of RAM). One of my advisors suggested I<BR>&gt; &gt; compile in release mode to speed things up. The file compiles with no errors<BR>&gt; &gt; or warnings. However, when I run it, it crashes and and just asks whether I<BR>&gt; &gt; want to report it to Microsoft.<BR>&gt; &gt;<BR>&gt; &gt; I ran the file through dependency walker and the report is as follows:<BR>&gt; &gt;<BR>&gt; &gt; Starting profile on 8/9/2008 at 2:26:13 PM<BR>&gt; &gt; Operating System: Microsoft Windows XP Professional (32-bit), version<BR>&gt; &gt; 5.01.2600 Service Pack 2<BR>&gt; &gt; Program Executable: c:\itktest\release\RR.EXE<BR>&gt; &gt; Program Arguments:<BR>&gt; &gt; Starting Directory: C:\ITKTest\Release\<BR>&gt; &gt; Search Path:<BR>&gt; &gt; C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program<BR>&gt; &gt; Files\MATLAB\R2007b\bin;C:\Program Files\MATLAB\R2007b\bin\win32;C:\Program<BR>&gt; &gt; Files\CMake 2.6\bin;C:\Program Files\ITK<BR>&gt; &gt; Options Selected:<BR>&gt; &gt; Simulate ShellExecute by inserting any App Paths directories into the PATH<BR>&gt; &gt; environment variable.<BR>&gt; &gt; Log DllMain calls for process attach and process detach messages.<BR>&gt; &gt; Hook the process to gather more detailed dependency information.<BR>&gt; &gt; Log LoadLibrary function calls.<BR>&gt; &gt; Log GetProcAddress function calls.<BR>&gt; &gt; Log debug output messages.<BR>&gt; &gt; Automatically open and profile child processes.<BR>&gt; &gt; --------------------------------------------------------------------------------<BR>&gt; &gt; Started 'RR.EXE' (process 0xBEC) at address 0x00400000. Successfully hooked<BR>&gt; &gt; module.<BR>&gt; &gt; Loaded 'NTDLL.DLL' at address 0x7C900000. Successfully hooked module.<BR>&gt; &gt; Loaded 'KERNEL32.DLL' at address 0x7C800000. Successfully hooked module.<BR>&gt; &gt; DllMain(0x7C900000, DLL_PROCESS_ATTACH, 0x00000000) in 'NTDLL.DLL' called.<BR>&gt; &gt; DllMain(0x7C900000, DLL_PROCESS_ATTACH, 0x00000000) in 'NTDLL.DLL' returned<BR>&gt; &gt; 1 (0x1).<BR>&gt; &gt; DllMain(0x7C800000, DLL_PROCESS_ATTACH, 0x00000000) in 'KERNEL32.DLL'<BR>&gt; &gt; called.<BR>&gt; &gt; DllMain(0x7C800000, DLL_PROCESS_ATTACH, 0x00000000) in 'KERNEL32.DLL'<BR>&gt; &gt; returned 1 (0x1).<BR>&gt; &gt; Injected 'DEPENDS.DLL' at address 0x08370000.<BR>&gt; &gt; DllMain(0x08370000, DLL_PROCESS_ATTACH, 0x00000000) in 'DEPENDS.DLL' called.<BR>&gt; &gt; DllMain(0x08370000, DLL_PROCESS_ATTACH, 0x00000000) in 'DEPENDS.DLL'<BR>&gt; &gt; returned 1 (0x1).<BR>&gt; &gt; Loaded 'ITKCOMMON.DLL' at address 0x10000000. Successfully hooked module.<BR>&gt; &gt; Loaded 'USER32.DLL' at address 0x7E410000. Successfully hooked module.<BR>&gt; &gt; Loaded 'GDI32.DLL' at address 0x77F10000. Successfully hooked module.<BR>&gt; &gt; Loaded 'MSVCP90D.DLL' at address 0x10480000. Successfully hooked module.<BR>&gt; &gt; Loaded 'MSVCR90D.DLL' at address 0x00240000. Successfully hooked module.<BR>&gt; &gt; Loaded 'ADVAPI32.DLL' at address 0x77DD0000. Successfully hooked module.<BR>&gt; &gt; Loaded 'RPCRT4.DLL' at address 0x77E70000. Successfully hooked module.<BR>&gt; &gt; Loaded 'SECUR32.DLL' at address 0x77FE0000. Successfully hooked module.<BR>&gt; &gt; Loaded 'WSOCK32.DLL' at address 0x71AD0000. Successfully hooked module.<BR>&gt; &gt; Loaded 'WS2_32.DLL' at address 0x71AB0000. Successfully hooked module.<BR>&gt; &gt; Loaded 'MSVCRT.DLL' at address 0x77C10000. Successfully hooked module.<BR>&gt; &gt; Loaded 'WS2HELP.DLL' at address 0x71AA0000. Successfully hooked module.<BR>&gt; &gt; Loaded 'SNMPAPI.DLL' at address 0x71F60000. Successfully hooked module.<BR>&gt; &gt; Loaded 'MSVCP90.DLL' at address 0x78480000. Successfully hooked module.<BR>&gt; &gt; Loaded 'MSVCR90.DLL' at address 0x78520000. Successfully hooked module.<BR>&gt; &gt; Entrypoint reached. All implicit modules have been loaded.<BR>&gt; &gt; DllMain(0x77F10000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'GDI32.DLL' called.<BR>&gt; &gt; DllMain(0x77F10000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'GDI32.DLL' returned<BR>&gt; &gt; 1 (0x1).<BR>&gt; &gt; DllMain(0x7E410000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'USER32.DLL' called.<BR>&gt; &gt; DllMain(0x7E410000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'USER32.DLL' returned<BR>&gt; &gt; 1 (0x1).<BR>&gt; &gt; DllMain(0x00240000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'MSVCR90D.DLL'<BR>&gt; &gt; called.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'FlsAlloc') called from<BR>&gt; &gt; 'MSVCR90D.DLL' at address 0x0027E339 and returned NULL. Error: The specified<BR>&gt; &gt; procedure could not be found (127).<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'FlsGetValue') called from<BR>&gt; &gt; 'MSVCR90D.DLL' at address 0x0027E34D and returned NULL. Error: The specified<BR>&gt; &gt; procedure could not be found (127).<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'FlsSetValue') called from<BR>&gt; &gt; 'MSVCR90D.DLL' at address 0x0027E361 and returned NULL. Error: The specified<BR>&gt; &gt; procedure could not be found (127).<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'FlsFree') called from<BR>&gt; &gt; 'MSVCR90D.DLL' at address 0x0027E375 and returned NULL. Error: The specified<BR>&gt; &gt; procedure could not be found (127).<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'EncodePointer') called from<BR>&gt; &gt; 'MSVCR90D.DLL' at address 0x0027E0DC and returned 0x7C913917.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'EncodePointer') called from<BR>&gt; &gt; 'MSVCR90D.DLL' at address 0x0027E0DC and returned 0x7C913917.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'EncodePointer') called from<BR>&gt; &gt; 'MSVCR90D.DLL' at address 0x0027E0DC and returned 0x7C913917.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'EncodePointer') called from<BR>&gt; &gt; 'MSVCR90D.DLL' at address 0x0027E0DC and returned 0x7C913917.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'EncodePointer') called from<BR>&gt; &gt; 'MSVCR90D.DLL' at address 0x0027E0DC and returned 0x7C913917.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'EncodePointer') called from<BR>&gt; &gt; 'MSVCR90D.DLL' at address 0x0027E0DC and returned 0x7C913917.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'EncodePointer') called from<BR>&gt; &gt; 'MSVCR90D.DLL' at address 0x0027E0DC and returned 0x7C913917.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'DecodePointer') called from<BR>&gt; &gt; 'MSVCR90D.DLL' at address 0x0027E1DC and returned 0x7C91393D.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'DecodePointer') called from<BR>&gt; &gt; 'MSVCR90D.DLL' at address 0x0027E1DC and returned 0x7C91393D.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'EncodePointer') called from<BR>&gt; &gt; 'MSVCR90D.DLL' at address 0x0027E5DB and returned 0x7C913917.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'DecodePointer') called from<BR>&gt; &gt; 'MSVCR90D.DLL' at address 0x0027E5F3 and returned 0x7C91393D.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'IsProcessorFeaturePresent')<BR>&gt; &gt; called from 'MSVCR90D.DLL' at address 0x00335A0B and returned 0x7C80AE2A.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'FindActCtxSectionStringW') called<BR>&gt; &gt; from 'MSVCR90D.DLL' at address 0x0027CA3A and returned 0x7C82FD4C.<BR>&gt; &gt; DllMain(0x00240000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'MSVCR90D.DLL'<BR>&gt; &gt; returned 1 (0x1).<BR>&gt; &gt; DllMain(0x10480000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'MSVCP90D.DLL'<BR>&gt; &gt; called.<BR>&gt; &gt; DllMain(0x10480000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'MSVCP90D.DLL'<BR>&gt; &gt; returned 1 (0x1).<BR>&gt; &gt; DllMain(0x77FE0000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'SECUR32.DLL' called.<BR>&gt; &gt; DllMain(0x77FE0000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'SECUR32.DLL'<BR>&gt; &gt; returned 1 (0x1).<BR>&gt; &gt; DllMain(0x77E70000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'RPCRT4.DLL' called.<BR>&gt; &gt; DllMain(0x77E70000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'RPCRT4.DLL' returned<BR>&gt; &gt; 1 (0x1).<BR>&gt; &gt; DllMain(0x77DD0000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'ADVAPI32.DLL'<BR>&gt; &gt; called.<BR>&gt; &gt; DllMain(0x77DD0000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'ADVAPI32.DLL'<BR>&gt; &gt; returned 1 (0x1).<BR>&gt; &gt; DllMain(0x10000000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'ITKCOMMON.DLL'<BR>&gt; &gt; called.<BR>&gt; &gt; DllMain(0x10000000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'ITKCOMMON.DLL'<BR>&gt; &gt; returned 1 (0x1).<BR>&gt; &gt; DllMain(0x77C10000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'MSVCRT.DLL' called.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL],<BR>&gt; &gt; 'InitializeCriticalSectionAndSpinCount') called from 'MSVCRT.DLL' at address<BR>&gt; &gt; 0x77C379C2 and returned 0x7C80B829.<BR>&gt; &gt; DllMain(0x77C10000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'MSVCRT.DLL' returned<BR>&gt; &gt; 1 (0x1).<BR>&gt; &gt; DllMain(0x71AA0000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'WS2HELP.DLL' called.<BR>&gt; &gt; DllMain(0x71AA0000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'WS2HELP.DLL'<BR>&gt; &gt; returned 1 (0x1).<BR>&gt; &gt; DllMain(0x71AB0000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'WS2_32.DLL' called.<BR>&gt; &gt; DllMain(0x71AB0000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'WS2_32.DLL' returned<BR>&gt; &gt; 1 (0x1).<BR>&gt; &gt; DllMain(0x71AD0000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'WSOCK32.DLL' called.<BR>&gt; &gt; DllMain(0x71AD0000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'WSOCK32.DLL'<BR>&gt; &gt; returned 1 (0x1).<BR>&gt; &gt; DllMain(0x71F60000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'SNMPAPI.DLL' called.<BR>&gt; &gt; DllMain(0x71F60000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'SNMPAPI.DLL'<BR>&gt; &gt; returned 1 (0x1).<BR>&gt; &gt; DllMain(0x78520000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'MSVCR90.DLL' called.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'FlsAlloc') called from<BR>&gt; &gt; 'MSVCR90.DLL' at address 0x78543ACC and returned NULL. Error: The specified<BR>&gt; &gt; procedure could not be found (127).<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'FlsGetValue') called from<BR>&gt; &gt; 'MSVCR90.DLL' at address 0x78543AD9 and returned NULL. Error: The specified<BR>&gt; &gt; procedure could not be found (127).<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'FlsSetValue') called from<BR>&gt; &gt; 'MSVCR90.DLL' at address 0x78543AE6 and returned NULL. Error: The specified<BR>&gt; &gt; procedure could not be found (127).<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'FlsFree') called from<BR>&gt; &gt; 'MSVCR90.DLL' at address 0x78543AF3 and returned NULL. Error: The specified<BR>&gt; &gt; procedure could not be found (127).<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'EncodePointer') called from<BR>&gt; &gt; 'MSVCR90.DLL' at address 0x785435E2 and returned 0x7C913917.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'EncodePointer') called from<BR>&gt; &gt; 'MSVCR90.DLL' at address 0x785435E2 and returned 0x7C913917.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'EncodePointer') called from<BR>&gt; &gt; 'MSVCR90.DLL' at address 0x785435E2 and returned 0x7C913917.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'EncodePointer') called from<BR>&gt; &gt; 'MSVCR90.DLL' at address 0x785435E2 and returned 0x7C913917.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'EncodePointer') called from<BR>&gt; &gt; 'MSVCR90.DLL' at address 0x785435E2 and returned 0x7C913917.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'EncodePointer') called from<BR>&gt; &gt; 'MSVCR90.DLL' at address 0x785435E2 and returned 0x7C913917.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'EncodePointer') called from<BR>&gt; &gt; 'MSVCR90.DLL' at address 0x785435E2 and returned 0x7C913917.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'DecodePointer') called from<BR>&gt; &gt; 'MSVCR90.DLL' at address 0x78543667 and returned 0x7C91393D.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'DecodePointer') called from<BR>&gt; &gt; 'MSVCR90.DLL' at address 0x78543667 and returned 0x7C91393D.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'EncodePointer') called from<BR>&gt; &gt; 'MSVCR90.DLL' at address 0x7854379B and returned 0x7C913917.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'DecodePointer') called from<BR>&gt; &gt; 'MSVCR90.DLL' at address 0x785437AB and returned 0x7C91393D.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'IsProcessorFeaturePresent')<BR>&gt; &gt; called from 'MSVCR90.DLL' at address 0x785A34FB and returned 0x7C80AE2A.<BR>&gt; &gt; GetProcAddress(0x7C800000 [KERNEL32.DLL], 'FindActCtxSectionStringW') called<BR>&gt; &gt; from 'MSVCR90.DLL' at address 0x78542822 and returned 0x7C82FD4C.<BR>&gt; &gt; DllMain(0x78520000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'MSVCR90.DLL'<BR>&gt; &gt; returned 1 (0x1).<BR>&gt; &gt; DllMain(0x78480000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'MSVCP90.DLL' called.<BR>&gt; &gt; DllMain(0x78480000, DLL_PROCESS_ATTACH, 0x011CFD30) in 'MSVCP90.DLL'<BR>&gt; &gt; returned 1 (0x1).<BR>&gt; &gt; Exited 'RR.EXE' (process 0xBEC) with code -1073740777 (0xC0000417).<BR>&gt; &gt; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<BR>&gt; &gt;<BR>&gt; &gt; Could anyone please help me determine what is wrong? Also, is it normal for<BR>&gt; &gt; the debug mode code to take that long to run? Am I missing something big<BR>&gt; &gt; here?<BR>&gt; &gt;<BR>&gt; &gt; If this has been addressed before, please feel free to point me to the<BR>&gt; &gt; answer. I have tried to solve this by myself for a while but feel like I am<BR>&gt; &gt; just running my head into a wall. Any help or pointers would be welcome.<BR>&gt; &gt; Thank you.<BR>&gt; &gt;<BR>&gt; &gt; Vik<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt; ________________________________<BR>&gt; &gt; Your PC, mobile phone, and online services work together like never before.<BR>&gt; &gt; See how Windows(R) fits your life<BR>&gt; &gt; _______________________________________________<BR>&gt; &gt; Insight-users mailing list<BR>&gt; &gt; Insight-users@itk.org<BR>&gt; &gt; http://www.itk.org/mailman/listinfo/insight-users<BR>&gt; &gt;<BR>&gt; &gt;<BR><BR><br /><hr />Reveal your inner athlete and share it with friends on Windows Live. <a href='http://revealyourinnerathlete.windowslive.com?locale=en-us&ocid=TXT_TAGLM_WLYIA_whichathlete_us' target='_new'>Share now!</a></body>
</html>