LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Windows structured exception handling?

It's been a little while since I had the chance to visit this forum, work has been keeping me way too busy the last few weeks. I'm hoping one of you can help me with a little problem.
 
I've been getting unhandled exceptions in some of my code that are proving to be very difficult to debug (mostly the dreaded exception C0000005 Access violation). It would be a lot easier for me to see what is going on if I could intercept the exception and be able to look at the state of my threads without the program crashing out to Windows.
 
Does anyone know if there is any way to use the Windows Structured Exception Handling mechanism within CVI?
 
I have searched and the only thing I can find is some stuff in the SDK that does not work directly in CVI (using __try and __except blocks generates errors in the compiler, it does not recognize those structures).
 
Any help would be greatly appreciated.
Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 1 of 3
(3,927 Views)
Most modern programming languages support exceptions but not ISO C as used in CVI.  It takes both compiler and OS support to make it work, as you need access to the call stack.

C supports "signals" but Windows doesn't, so that won't work either.

http://www.on-time.com/ddj0011.htm    describes an exception handling library of a sort for C.  But it isn't SEH.

Looks like Microsoft put SEH support into C as created with the Visual C++ compiler. 

We've deployed debug builds of CVI to get a CVI popup that localizes a Win32 exception as it hits the OS and aborts.  At least you get some idea of where the error was.
0 Kudos
Message 2 of 3
(3,916 Views)
Thanks menchar.
 
What I finally ended up doing was running a debug version on the target system and it pointed me to the line where the problem was happening.
 
Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 3 of 3
(3,908 Views)