LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with the Call Llibrary Function Node when a DLL returns a pointer to data buffer.

I cannot see the data returned by the DLL following a barcode scan using a Symbol Technology reader. How do I get the character data if the DLL only returns a pointer to the data buffer? Connecting the

Here is the info on the DLL provided by Symbol:

Syntax

SSIDLL_API int __stdcall SetDecodeBuffer(int nComPort, unsigned char *pData, long

max_length);

where:

.

nComPort is the COM port number used in the call to SSIConnect

.

pData is a pointer to the destination buffer for decode data returned from the

scanner

.

max_length is the size in bytes of the destination buffer

Please offer guidance on this little snippet from the LabView Support pages...

Note  If the function you are calling returns a data type not listed, choose a return data type the same data size as the one returned by the function. For example, if the function returns a char data type, use an 8-bit unsigned integer. A call to a function in a DLL cannot return a pointer because there are no pointer types in LabVIEW. However, you can specify the return type as an integer that is the same size as the pointer. LabVIEW then treats the address as a simple integer, and you can pass it to future DLL calls.

0 Kudos
Message 1 of 23
(4,652 Views)

Hi poethomer,

you can use the "rtlMoveMemory" function from the Kernel32.ddl to copy the data into a LabView buffer.

Mike

Message 2 of 23
(4,640 Views)

Mike,

Thanks for the response. I'm a little rusty and trying to help an associate solve this problem. Can you elaborate on "copy the data into a LabView buffer" a little?

0 Kudos
Message 3 of 23
(4,620 Views)
You don't really need to resort to that. All that you should need to do is to pre-allocate a string in LabVIEW and pass it to the DLL call as shown in this example:





Message Edited by smercurio_fc on 02-27-2008 09:30 AM
Message 4 of 23
(4,613 Views)
Pre-allocating a string does not work. We had tried that previously. This scanner works fine with a .NET app we have so we know the scanner is returning data, but using LABView to call the DLL always results in an empty string. I am assuming that this is because the DLL is returning a pointer. I may be wrong. Any ideas at this point would be helpful. Also, I'm still interested in Mike's suggestion, unfortunately I don't quite know how toimplement it.
0 Kudos
Message 5 of 23
(4,601 Views)

Hi poethomer,

here is what i thought what can help you.

Mike

Message 7 of 23
(4,583 Views)
Attached is an example that does not resort to the MoveBlock method. In fact, there should be no reason to do this. The DLL is quite simple and is intended to simulate a scanner populating a buffer:

#include "extcode.h"
#include <string.h>

_declspec(dllexport) void ReadScanner(int comPort, unsigned char *input, int length);
_declspec(dllexport) void ReadScanner(int comPort, unsigned char *input, int length)
{
  strcpy(input, "SCANNERTEXT");
}

If you run the VI you will see the indicator say "SCANNERTEXT".

Message 8 of 23
(4,576 Views)

Hi,

 

I am running into similar kind of issue....how did you solve your problem????

 

Please post your solution if possible..that would be really helpfull to me..............

 

I am also using SSI DLL to communicate with symbol MS 4404 scanner..........

 

Thanks in advance...............

Anil Punnam
CLD
LV 2012, TestStand 4.2..........
0 Kudos
Message 9 of 23
(3,997 Views)
I'm sorry, but this situation was never resolved in LabVIEW. The makers of the Symbol products also could not offer any help. In the end, an associate of mine wrote a script in Visual Basic to read data from the DLL and write it to a text file. We called the VB script from within LabVIEW and then read the data out of the text file.
0 Kudos
Message 10 of 23
(3,977 Views)