01-10-2007 04:44 PM
01-11-2007 02:33 AM - edited 01-11-2007 02:33 AM
Hi Nathan,
Convert the string to an array of bytes (String- Array\Path\Conversion pallet) and then specify the Call Library Function (CLF) parameter as an array of "unsiged 8-bit integer". Notice the prototype now shows "unsigned char *" !
Drop an "Array Size" size function right-beside the CLF and wire it to the "length" input. ![]()
Cheers.
Message Edited by tbd on 01-11-2007 02:35 AM
Message Edited by tbd on 01-11-2007 02:36 AM
Message Edited by tbd on 01-11-2007 02:37 AM
01-11-2007 11:18 AM
01-11-2007 02:03 PM
Nathan, you haven't followed Nate's advice:
@nate818 wrote:I can't wire the "string to array of bytes" function to the uInt8 of the Call Library Node because the Call Library node is expecting a single uInt8, not a 1-D array of uInt8. I get the source data type doesn't match sink data type error. Even if I extracted the data in the array one byte at a time using a For loop, I would be sending the actual data into the unwrapper, not the address of the data. Any other ideas?Nathan
01-11-2007 03:40 PM
01-11-2007 04:47 PM
01-12-2007 12:45 AM - edited 01-12-2007 12:45 AM
Use the POINTER Luke Nathan! ![]()
Seriously, the Pointer is the right method.
Other things to check: If the DLL wants a Zero-terminated string/buffer, you may have to add a zero-byte to the end of the input [U8] array. Make sure Length is wired and equals the input array-length. I'm guessing Length should be passed by Value!(?) Also, if reading-back a string (or array) then you'll (probably) have to pass-in a string/array at least as big as the result is supposed to be (just fill it with zeros.)
And if it still doesn't work, we're still missing something simple (like an incorrect datatype or calling-convention or broken DLL?
.)
... and, thank you for backing me up, TonP!
Message Edited by tbd on 01-12-2007 12:47 AM
01-12-2007 03:02 AM
@tbd wrote:
Use the POINTER
LukeNathan!Seriously, the Pointer is the right method.
Other things to check: If the DLL wants a Zero-terminated string/buffer, you may have to add a zero-byte to the end of the input [U8] array. Make sure Length is wired and equals the input array-length. I'm guessing Length should be passed by Value!(?) Also, if reading-back a string (or array) then you'll (probably) have to pass-in a string/array at least as big as the result is supposed to be (just fill it with zeros.)
And if it still doesn't work, we're still missing something simple (like an incorrect datatype or calling-convention or broken DLL?
.)
... and, thank you for backing me up, TonP!
![]()
Message Edited by tbd on 01-12-2007 12:47 AM
Since the DLL function also wants the buffer length I doubt that it is expecting a zero termination character. But who knows! Maybe the OP misunderstands the function documentation (has he read that at all?).
If you really need zero termination you can do that yourself or just pass the string as string and configure the Call Library Node parameter to be a String too and use the C style String pointer type there. LabVIEW will take care to append a zero byte before passing the string pointer and if you also wire the output side of that parameter copy the contents from that pointer back into a string handle up to the first zero byte. It is obvious from this that a string buffer is not the right thing to pass to a CLN in LabVIEW if that buffer can legally contain zero bytes too.
Rolf Kalbermatter
01-12-2007 03:21 AM