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: 

Passing a cluster with 2D array to a labwindow/cvi DLL

Hi,

I'm new here and I need help. Thank you

0 Kudos
Message 1 of 4
(2,108 Views)

You should include more information. How far did you get before getting stuck? Are you seeing some errors? Maybe attach your VI and DLL files so other people can download to debug the problem.

0 Kudos
Message 2 of 4
(2,100 Views)

Posting a pic instead of both the C code and actual VI is definitely not very helpful. But I can tell you at least that you are already doing some things wrong.

 

The calling_file and error_string parameter is a string and passing it as array of 8-bit chars will make it impossible for your C code to properly use it. Strings are in C NULL terminated, in LabVIEW not (the length of the array is a separate attribute of the string). In order to make them be passed as NULL terminated C strings you have to configure the parameter as String, pass as C String Data Pointer. That way LabVIEW will perform the right conversion and append a NULL byte to the end of the string before passing it to the DLL.

Your Session structure is NOT going to work like this! You do NOT want to pass arrays and or strings inside a cluster to a C DLL. The resulting arrays are LabVIEW string or array handles, not C data pointer. Only a DLL specifically written to expect these LabVIEW data handles can deal with them properly. Instead pass strings and arrays as an additional parameter to the DLL. However an array (1 or more dimensional) of strings will also not work. Each string in the array is again a LabVIEW handle.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 4
(2,069 Views)

Thank you for all replies. Sorry, it's a part of the larger DLL and I can't post it here due to the copyright ...

I'll try to break it down to a single function and post it.

Thanks again.

0 Kudos
Message 4 of 4
(2,051 Views)