LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamicaly allocated string when calling DLL

In a SubVI I need to call a function contained in a DLL library. This function return a string. The get that string I need to provide a C string pointer and allocate necessary space for that string. How could I build an empty string in a fast way. Actualy I'm building the empty string in a for loop... It is completely ridiculus... CPU demanding for no good reason.

Thanks for your help

Nitrof
0 Kudos
Message 1 of 3
(2,692 Views)
Hi,
I'm not sure that I've got the problem but if you need to wire the empty string constant to the input node of "Call Library Function.vi" you can take it in
"Functions->String->Empty String".
This constant is in the second item in the last row of the palette.

Good luck.

Oleg Chutko.
0 Kudos
Message 2 of 3
(2,692 Views)
> In a SubVI I need to call a function contained in a DLL library. This
> function return a string. The get that string I need to provide a C
> string pointer and allocate necessary space for that string. How
> could I build an empty string in a fast way.

Since strings and array of bytes are so similar, use the Initialize
Array node to make an array of lots of zeroes. When cast to a string,
this will be a string full of 0x00. When passed to the DLL, the buffer
will be the right size, and the first byte will be 0x00 or NULL.

Anytime you are building arrays, you should look to use the initialize
array rather than shift registers and build array.

Greg McKaskle
Message 3 of 3
(2,692 Views)