LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Resizing labview array using c code

I have a LabVIEW structure(control) in the format, array of clusters of double arrays. I try to resize it using DSSetHandleSize method in a c file but it crashes abruptly.
I created separate files for each array's, one for clusterarray and another for doublearray and converted it into dll's and tried to run it in a single VI.
And the result of that was only the clusterarray is resized and the doublearray is not resized and calling the doublearray dll also changes the size of clusterarray.

Help to try and fix it.
Note:
sample.vi->runs the dll's

0 Kudos
Message 1 of 3
(819 Views)

@Vicky_77 wrote:

I have a LabVIEW structure(control) in the format, array of clusters of double arrays. I try to resize it using DSSetHandleSize method in a c file but it crashes abruptly.
I created separate files for each array's, one for clusterarray and another for doublearray and converted it into dll's and tried to run it in a single VI.
And the result of that was only the clusterarray is resized and the doublearray is not resized and calling the doublearray dll also changes the size of clusterarray.

Help to try and fix it.
Note:
sample.vi->runs the dll's


Yeah, I imagine that would crash LabVIEW pretty much every time!  Start reading here 

 

An array of clusters of arrays of DBLs is going to be very tricky for calculating the size.  The cluster elements need to be padded for alignment based on OS requirements, the arrays inside need to be padded and their order in the cluster will need to be known.   

 

Overall, you are just not going to get ahead of the LabVIEW memory manager by recreating some of these functions. And any change on either side of the struct will probably require a recalculation.   Or, you can just rename your vi to "Crash LabVIEW?.vi" 😷


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 3
(765 Views)

Can you explain the purpose of this exercise? If you really want to do that you need to read up on the LabVIEW memory manager functions, memory layout in C, C dynamic memory allocation and a few other advanced C programming topics. It can be done, but requires a lot more than very good LabVIEW programming experience.

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