LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

exception handling

Hi,
I wish to trap operating systems signals in my CVI application. I know how to trap signals on UNIX or Linux. I know windows also generate signals such as SIGSEGV. ANSCI C provides a function signal in signal.h for handling signals. I tried using it. I could compile my code successfully. However, the signal handler was not called when signal was generated. I know SIGSEGV is not generated in windows NT. I tried it on XP as well. I could not trap the signal. However, when I exclusively raised the signal using function called raise, I could trap it. But I could not trap signals generated by operating system.
Is anybody of you has trapped siganls in CVI on windows?
Basically, I want to avoid abrupt program termination ocuuring from segmentation fault o
r memory allocation problem. Does anybody know about it?

Niranjan
0 Kudos
Message 1 of 2
(2,977 Views)
Actually, I think I've answered this question for you via email correspondence before, but if I didn't here is the information you need on the supported signals that the Windows OSs generate and how they can be handled in your application.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_signal.asp

If you read through this document you will see that under any NT based OS (including XP) the SIGSEGV signal is not generated. You will have to raise this yourself in order to handle it. You may want to try using Structured Exception Handling exposed by the Platform SDK in ordre to catch this type of system exception (I'm not sure if you can, but this would be the only other way that it would be possible). Just look for the SEH topi
cs on the same MSDN site as I pointed you to above.

Jason F.
Applications Engineer
National Instruments
www.ni.com/ask
0 Kudos
Message 2 of 2
(2,977 Views)