Jump to content

DLL call string parameter change


Recommended Posts

It seems like the C string parameter is now behaving slightly different on the DLL call. I have a function that requires a prealocated space, so I supply it with a string of sufficient length and tell the function in the next parameter how much space it is allowed to use. There is a difference between how LV 7.1.1 handles the returned string and how LV8.2 does that. The former leaves the string unbothered, even if there are null characters in it. LV 8.2 seems to think "it's a C string, so a 0 means end of string" and consequently it cuts the string just before this 0 character. This is usually good, but not always: often we knew that a C string was the same as a C U8 array so we used strings as medium to transfer bytes even if they could be zero. It seems we cannot do that anymore in LV8. Well, maybe it's better this way.

Joris

Link to comment

QUOTE(robijn @ Jul 4 2007, 10:44 AM)

It seems like the C string parameter is now behaving slightly different on the DLL call. I have a function that requires a prealocated space, so I supply it with a string of sufficient length and tell the function in the next parameter how much space it is allowed to use. There is a difference between how LV 7.1.1 handles the returned string and how LV8.2 does that. The former leaves the string unbothered, even if there are null characters in it. LV 8.2 seems to think "it's a C string, so a 0 means end of string" and consequently it cuts the string just before this 0 character. This is usually good, but not always: often we knew that a C string was the same as a C U8 array so we used strings as medium to transfer bytes even if they could be zero. It seems we cannot do that anymore in LV8. Well, maybe it's better this way.

I was pretty sure that LabVIEW terminated strings on return on the first NULL character already in LabVIEW 7 and I think even in LabVIEW 6. I did rely in 6.x several times on that, so not sure why you would see something else. If that is not desired you need to use byte arrays.

Rolf Kalbermatter

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.