LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array allocation and initialization with a .dll to be used in Labview


@moonfall wrote:

Dear 


You need to make a test dll to see if the calling convention is correct.

 

If you make a dll with two arrays as input, you still won't know. If the order is reversed, you'd still get the expected result.

 

Make a dll with an array and a scalar. Add the scalar to the array. If that works, your calling convention is correct.

0 Kudos
Message 11 of 13
(51 Views)

@moonfall wrote:

 


Of course you could implement the same in LabVIEW too. I do fitting on very complicated models (example) in pure LabVIEW and of course use all the tricks in the book, such as lookup tables, vectorization, and caching of intermediary results, etc. Smiley Wink


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 12 of 13
(43 Views)

An unbounded Matlab array is in reality a somewhat complicated data structure that you have to create, reallocate and deallocate by calling specific Matlab C runtime functions. The LabVIEW Call Library Node has ABSOLUTELY no knowledge about this. The standard way is to write a wrapper DLL in C which provides more LabVIEW friendly parameters and translates them into the Matlab unbounded arrays before calling the Matlab DLL function (and possibly translates similar output arrays back into LabVIEW friendly datatypes before returning to LabVIEW.

It is theoretically possible to call the Matlab C runtime functions to deal with unbounded arrays also through additional Call Library Nodes so you don’t need to create the extra wrapper DLL but this requires even more low level C programming knowledge than writing the wrapper DLL, since you will basically take over some of the work the C compiler would do for you.

Rolf Kalbermatter
Averna BV
LabVIEW ArchitectLabVIEW ChampionLabVIEW Instructor
Message 13 of 13
(29 Views)