LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to set the Call Library Function Node if parameter called by reference

Solved!
Go to solution

The format for calling third-party library functions in C++ is:

 

short mc;
short timeout = 500; /*ms,
char *ip = “192.168.100.1”;
short rtn = 0;
rtn = ZT_Open(ip, &mc, timeout); 

 

How to set the types of parameters mc and ip when calling ZT_Open by using the Call Library Function Node in LabVIEW

 

 

0 Kudos
Message 1 of 2
(1,176 Views)
Solution
Accepted by topic author REDJ

ip is a String, C string pointer, (This is simply a pointer and is not considered a reference really)

mc is a int16, pass: pointer to value (this is the same as a value reference really)

 

The difference about what a pointer and reference means is mostly really just semantics. In C there is no real difference at all between the two . In C++ a reference parameter is one which is explicitly passed to the function in a way that can have direct effects on the location where the variable is stored. A non reference parameter is valid to be assumed by the compiler as not being modified by a function call. But that is all stuff you do not want to know if you don't program in C(++).

 

As far as the LabVIEW Call Library Node is concerned the most important point to take away is that a variable reference is equivalent to the pointer to that variable.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 2 of 2
(1,152 Views)