[Insight-users] Example code crashes when compiled in release mode

Vikren Sarkar vikmonster at hotmail.com
Sun Aug 10 17:12:19 EDT 2008


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


More information about the Insight-users mailing list