From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LABVIEW DLL- ARRAY INPUT AND ARRAY OUTPUT

I was trying to create a 64bit DLL using LABVIEW 64bit. The code accepts an array as input (U8 type) and returns two array output (one double and one I32).

 

I was able to create the DLLs but they never worked. Can you please help me out with an example?

 

Thanks

RY
0 Kudos
Message 1 of 8
(4,599 Views)

I believe you need to preallocate the array input and outputs.  See here for more info: http://forums.ni.com/t5/LabVIEW/Problem-in-calling-LabVIEW-DLL-with-C/td-p/2627315

 

Also, are you calling from C#, i presume?  Anything more specific - such as what you want to acomplish would be helpful.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If someone helped you out, please select their post as the solution and/or give them Kudos!
0 Kudos
Message 2 of 8
(4,586 Views)

Dont laugh on my stupid experiment. I am creating a DLL and calling it back in LABVIEW.[:)]

 

I have preallocated memory.

RY
0 Kudos
Message 3 of 8
(4,578 Views)

Oh wait.  You are making a DLL and calling it inside LabVIEW?

 

My bad for misunderstanding haha.

 

Use this: Call Library Function Node

 

You can find detailed guides here:

 

http://www.ni.com/white-paper/3009/en/

http://zone.ni.com/reference/en-XX/help/371361J-01/lvexcodeconcepts/configuring_the_clf_node/

 

If you have a more specific question regarding them, let me know!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If someone helped you out, please select their post as the solution and/or give them Kudos!
0 Kudos
Message 4 of 8
(4,564 Views)

Please see screenshots of the source code and calling function, I can read just one sample out of the ARRAY but not the complete array. Even though I specify the length of input arrray. Any idea what's wrong ....

 

 

RY
Download All
0 Kudos
Message 5 of 8
(4,557 Views)

What do you mean by "just one sample out of the ARRAY"? Which array? Can you provide the actual code instead of a screenshot, saved with default data?

 

How did you configure the DLL build? It's important whether you configured it to accept LabVIEW-specific data, or a more generic C array. In the case of a C array, multi-dimensional arrays are tricky and may not work properly; it would be better to pass a 1-D array.

0 Kudos
Message 6 of 8
(4,529 Views)

I finally fixed the issue. The return value has to be array by handle instead of array by pointer. Initialization didn't make any change but caused a bit overload. 

 

Thanks

RY
0 Kudos
Message 7 of 8
(4,494 Views)

Glad to hear you got it working. The configuration needs to match between the way you build the DLL (when you define the VI's prototype) and the way you call it. Note that if you're passing parameters as handles, it will be very difficult to call that DLL properly from any language other than LabVIEW (and if you don't need to call it outside of LabVIEW, then why are you building a DLL?).

0 Kudos
Message 8 of 8
(4,482 Views)