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