LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I return error code from a DLL?

I have a C++ DLL that can throw an exception.  In the C function interface between LabView and the C++ class, I catch exceptions so they don't go up to LabView.  But I want to get the error to the calling VI.  Is there a way to get an error code into the error bundle that comes out of the Call Library Function Node so that I can feed it to the simple error dialog box?  The exception has a string that describes the error and where it came from.  Or should I just make every DLL call return an error string (empty string if no error)?

Thanks,
Keith.

0 Kudos
Message 1 of 2
(3,567 Views)
Normally the convention is to use an integer return code with a return code of zero meaning no error. You can then create an error cluster based on this return value. The best thing to do is to have a "Error Code Check" subVI that you plop down each time. The error cluster for the Call Library Function function will tell you of problems with the LabVIEW <--> DLL interface. In fact, earlier versions of LabVIEW did not have an error in/error out cluser for that function. I'm not aware of being able to automatically set the error out cluster for the Call Library Function function. With the .NET interface it's different. If the method throws an exception you get the error out cluster with the error code of 1172 I think.
0 Kudos
Message 2 of 2
(3,563 Views)