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: 

Modifying the "Minimum Size" of a C String Pointer in Call Library Function (LV 8.2.1)

Hello there,

I read with great interest the posting, global variable corruption (slugger, 03-01-2007 10:46 AM). This posting touched on the new Minimum Size parameter one can set for the C String Pointer (String format). The problem I'm facing is that I'd like to control the minimum size of the buffer allocated by the minimum size parameter. Why you ask.....?

Whenever I wire a string constant on the block diagram, it always defaults to the Minimum Size buffer and pads my string with NULLS (\0). Is this expected behaviour? In my application, a typical control string is 13 chars long. Since my input strings into my DLL are likely to be variable, is there some way to dynamically size the buffer? FYI - my DLL runs in the UI thread.

My configuration:

Win XP SP2
LabVIEW 8.2.1
TestStand 4.0

Would appreciate any pointers (no pun intended...)

-Chroma
0 Kudos
Message 1 of 2
(2,450 Views)
Hello Chroma,

The purpose of this minimum size parameter is intended exactly for setting the minimum size of the buffer allocated. Thus, if you specify a size of 13 for the minimum size, any smaller strings will in fact be padded as you have seen. If you'd like to dynamically size the buffer, then do not set a minimum size for the buffer allocation. When your application runs, the buffer will be allocated dynamically based on the size of the string that is wired into the Call Library Function Node. I hope I have correctly understood your situation and that this information is useful for you. Post back if we can provide any additional assistance. Thanks.

Mike D.
National Instruments
Applications Engineer
0 Kudos
Message 2 of 2
(2,415 Views)