Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

Exit Code or Return Code Status Bit Returned from LabVIEW

Primary Software: LabVIEW Development Systems>>Professional Development System
Primary Software Version: 8.5.1
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I am looking for the exit code or return code status byte that is returned to a calling program from the called application.  When I call a LabVIEW executable (EXE) I do not get see this status bit, how can I get the exit or return status of my EXE?

Solution:
Currently, LabVIEW EXEs do not register an exit or return status to the operating system or the calling program.  An easy solution is to use a Call Library Function Node and call the Windows function exit or _exit from msvcrt.dll.  This dll is located at WINDOWS\system32\msvcrt.dll.  

As stated in the MSDN article (See related links):  Although the exit and _exit calls do not return a value, the low-order byte of status is made available to the waiting calling process, if one exists, after the calling process exits. The status value is available to the operating system batch command ERRORLEVEL and is represented by one of two constants: EXIT_SUCCESS, which represents a value of 0, or EXIT_FAILURE, which represents a value of 1.

Even though this method will return the status to the operating system and will shutdown the application, it is not recommended. Using this method will simply terminate the process and may not perform all of the procedures that LabVIEW would otherwise do during shutdown such as closing file references, clearing temporary files, etc.

Related Links:
MSDN: exit, _exit

Attachments:





Report Date: 04/16/2008
Last Updated: 04/17/2008
Document ID: 4KFET44M

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit