11-18-2013 04:15 PM - edited 11-18-2013 04:22 PM
Let's say I have a DLL function that I need to call in LabVIEW, and in C the code would look like:
unsinged long input1;
unsinged long input2;
testfunction(&input1, input2);
It is easy to do the opposite of:
testfuntion(*input1, input2);
Any quick suggestions or places to look?
Edit: This is for a simple DLL Library call. And for clarity, what the function is expecting is a memory address.
11-18-2013 05:10 PM
Have you looked at the Call Library Function Node configuration dialog box? There's an option to pass a value by pointer.
11-18-2013 05:38 PM
I have. Unfortunately, I need to pass a reference in, not a pointer. Ideally it would be the memory address of a control so that the function could change the value.
11-18-2013 05:40 PM
A reference to a value and a pointer to a value are exactly the same thing in C. And the Call Library Interface uses C logic.
11-18-2013 05:48 PM
It would appear there is a lack in my understanding. In C the function will take the address and change the value there to be used in later function calls. The "real" code is for an IVI/VXI Visa driver that I'm having issues with. Basically in C, the code is:
unsigned long session;
init("VXI0::9::INST::",&session);
setchannels(session,1);
getdata(session);
... etc.
In this case the init function just changed the value of the memory address at session, and then that variable is just fed in to every other function.
11-18-2013 05:52 PM
When you configure the Call Library Function Node, you will configure the "init" function to pass the session parameter by pointer. The function will receive a pointer (or reference) to the memory address of that wire, and will update it with the new session value. The output side of that parameter will be the session value, which you can then pass by value to the following functions.
It looks just like it does in C. You configure the "init" function for the session parameter to be passed by pointer, and then you take the corresponding output and pass it by value to the other functions.