LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

import DLL, function with void * parameter

Solved!
Go to solution

I have a DLL that I want import to Labview.

The problem is that there is this funzione:

int32_t GetParam(HANDLE DeviceHandle, int32_t ParamId, void *ParamValue, int32_t ParamSize)

where *ParamValue is a pointer to a float or a int.

when importing I have to specify Data type, and in pass I set "pointer to value".

But What have to specify in Data type?

Thanks,

S.

0 Kudos
Message 1 of 4
(738 Views)
Solution
Accepted by topic author nept

I do not speak with experience or authority here, this is only a suggestion:

 

I presume that you know in advance what kind of data type the function expects. You can create two CLFN nodes, one for the integer type and the other for the float (or double?). Then call the correct one, depending on the expected return type.

0 Kudos
Message 2 of 4
(704 Views)

LabVIEW is strictly typed and doesn’t allow variables to change type at runtime, except for variants but they are a lot more complex under the hood than a typeless void pointer.

 

So follow Lindenbauers advice, Make two VIs calling this function with a Call Library Node, one using a double float and one using an int32. You need to know which type to use when you want to access a specific parameter, also when programming in C.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 4
(681 Views)

thanks, i hadn't thought about this simple solution

0 Kudos
Message 4 of 4
(614 Views)