LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Documentation for DSSetHandleSize

Solved!
Go to solution

 

Hi everyone,

I'm new to LabVIEW, so I apologize in advance for any mistakes or confusion in my question.

I'm trying to pass arrays or clusters from my DLL to LabVIEW. Here's the solution I've implemented:

 

 

 

Spoiler

typedef struct {
int32_t dimSize;
int32_t elt[1];
} Array1DInt;

typedef Array1DInt** A1DDhandle;

void __declspec(dllexport) getArray1D(A1DDhandle arr)

{

int i; // Allocate memory for 4 elements DSSetHandleSize

(arr, sizeof(int32_t) + 4 * sizeof(int32_t));

(*arr)->dimSize = 4;

for (i = 0; i < 4; i++)

{ (*arr)->elt[i] = (i + 1) + 420; }

}

I gathered this code from various YouTube videos and forum entries, but I'd like to understand it better. Specifically, I'm looking for proper documentation for the functions from extcode.h. I couldn't find anything useful.

Can someone point me to detailed documentation ?

Thanks in advance for your help!

0 Kudos
Message 1 of 2
(236 Views)
Solution
Accepted by topic author alarmedWater

Is this detailed enough DSSetHandleSize? In your case you can use NumericArrayResize, so that you do not need to take the size part into account.

There is an example shipping with LabVIEW at LabVIEW 20XX\examples\Connectivity\Libraries and Executables\External Code (DLL) Execution.vi

 

Source C Files\LVLStrHandle.c contains an example using DSSetHandleSize, CLUSTERComplex.c contains an example using NumericArrayResize and shows how to handle dynamically sized data types in a cluster.

Message 2 of 2
(188 Views)