LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving PBYTE from DLL

Hello,
I need to retrieve data in LV 8.2 from a Delphi dll whose prototype is
 
function CB_FwVer: Pbyte; export; stdcall;
 
This function should pass a pointer to a 12 bytes sized array.
 
I tried to retrieve it as a numeric array using the Array Data Pointer format (void CB_FwVer(unsigned char *TVer);) but LV crashes!
an someone help me?
Thank you in advance
MC
 
 
 
0 Kudos
Message 1 of 3
(3,427 Views)


@ciampa wrote:
Hello,
I need to retrieve data in LV 8.2 from a Delphi dll whose prototype is
 
function CB_FwVer: Pbyte; export; stdcall;
 
This function should pass a pointer to a 12 bytes sized array.
 
I tried to retrieve it as a numeric array using the Array Data Pointer format (void CB_FwVer(unsigned char *TVer);) but LV crashes!
an someone help me?
Thank you in advance
MC


My Delphi knowledge is almost non-existent but your function prototype says its a function. In Delphi a function returns something while a procedure does not. Additionally your functions seems not to have a parameter list (no () after the function name). So I guess what you have is a function that would be in C noted as

unsigned char * CB_FwVer(void);

Now there is a problem with this. Since LabVIEW can not know how large the returned array is it does not support return of arrays. This simply can't work with the way LabVIEW does work. You could make this probably work by configuring the function to return an unsigned int32 which would be the pointer and then using a memcpy() call of some sort to copy the 12 bytes this pointer points to into a LabVIEW string. You can either try to find to find a memcpy() function in one of the C runtime DLLs or maybe a similar one in your Delphi DLL. Alternatively you can look for other posts here explaining how to call the LabVIEW provided MoveBlock() function through a Call Library Node.

Rolf Kalbermatter

Message Edited by rolfk on 05-14-2007 08:48 PM

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 3
(3,400 Views)

Hi,

 you're right, I arrived to the same end.

Thank you so much anyway for your reply.

Bye

Mauro

 

0 Kudos
Message 3 of 3
(3,386 Views)