From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create array of LV Strings in dll

Solved!
Go to solution

I copy pasted and rolfs code and it works like a charm.

 

one thing that remains unclear to me.

MgErr theFunction(SomeLVTypeHandle *arr){
int status = c.getAvailablePorts(ports);
if (status != EXIT_SUCCESS)
    return 501; //private error
return 0; // mgNoErr
}

What is the correct setup of call library function node that it consumes the MgErr and throws error?

0 Kudos
Message 11 of 12
(137 Views)

Basically a MgErr is simply a 32-bit integer, and the convention is that a 0 is success and anything else indicates an error. Your diagram is responsible to examine that error and put it into the error cluster of your VI if it determines that the function was not successful.

 

LabVIEW uses internally many standard error codes. They are positive for historical reason. But the modern convention in an error cluster is that negative codes are errors and positive codes are warnings. But ultimately the error cluster is considered only an error if the status is true. Most VIs in LabVIEW will skip their operation if an error cluster has an incoming true status. Exception to that are Close, Desroy or other deallocate functions which should attempt to try to do their cleanup even on an incoming error.

Rolf Kalbermatter
My Blog
0 Kudos
Message 12 of 12
(130 Views)