LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how to handle run-time errors in CVI

Hi,
I'm looking for an example with run-time error handling.  I've always used TS+CVI in my application and I know how to handle it there.
Now, I'm doing a CVI only application and I'm looking fro a good example to perform tht task
 
Thanks
Rafi
0 Kudos
Message 1 of 3
(4,259 Views)
I sometimes run a debug build without the CVI IDE - instead of the OS crashing the program you get a CVI popup giving you some idea of where the error occured and what the problem was.

Or, you can 'wrap" the CVI application in a C++ program that has an exception handler and catch any runtime exceptions coming up out of the CVI application.   The app doesn't crash, but your chances of doing something meaningful aren't particularly good due to limited info about the runtime error.   You can, however, figure out the nature of the error (e.g. was it a divide by zero error). 

When running the production build I've noticed that with pointer errors on WinXP SP2 we seem to get errors from the anti-worm service in XP SP2 that looks for data being executed as code.

You could try remote debugging - run the debug build on the target and use the CVI IDE from another machine (i.e. your development machine).  At least that way you don't have to install the development system on the target.  I use a laptop to host the IDE, that way I can walk up to a target and hookup with a TCP/IP connection and debug.

There's just no real substitute in C / CVI for not doing stupid things in the first place (e.g. de-referencing null pointers or dividing by zero) unless you run the debug build to let CVI help you find the problem. 

Menchar
0 Kudos
Message 2 of 3
(4,240 Views)
I have posted some note on run-time error checking in NI Community: there are some useful macros and some hint on how to intercept errors at run-time and react to them; you can look at them here.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 3 of 3
(4,209 Views)