05-02-2007 04:24 AM
05-14-2007 01:48 PM - edited 05-14-2007 01:48 PM
@ciampa wrote:
Hello,I need to retrieve data in LV 8.2 from a Delphi dll whose prototype isfunction 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 advanceMC
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
05-15-2007 01:49 AM
Hi,
you're right, I arrived to the same end.
Thank you so much anyway for your reply.
Bye
Mauro