LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

char pointer in a stucture for dll

Hi,

I have to send a structure to a dll, with a pointer to a char in. Here is the structure :

--------------------------
Struct Reference
Data Fields
unsigned long  CamType
  16 Bit used, hardware id of camera

 
unsigned long  VendorID
  24 Bit used, baumer ieee id

 
unsigned long  ChipIDHi
  8 Bit used, serial number of 1394 interface

 
unsigned long  ChipIDLo
  32 Bit used, serial number of 1394 interface

 
unsigned long  Payloadsize
  payloadsize of camera device

 
unsigned long  Reserved [8]
char  DspVersion [32]
  SignProc null terminated ansii string.

 
char  HwcVersion [32]
  label

 
unsigned long  CamLabel
  32 Bit used, label as logical camera id

 
char *  CamName
  null terminated ansii string
------------------------------

Can I do this without using CIN method ? If I can't, could you help me, I tried but I failed !

here is the dll function
FX_DeviceInfo( devNum,  &DevInformation  );  where &DevInformation is the structure !

Thanks
0 Kudos
Message 1 of 6
(3,923 Views)
I assume you want to read this information from the function, right?
In such cases a quick and dirty way is to read the sturture as a string and parse it byte by byte to relevant data...
 
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 2 of 6
(3,914 Views)
i used this method http://forums.lavag.org/index.php?act=Attach&type=post&id=1974 to put a cluster in input of the dll, but the output is a different cluster.

At input there's 2 arrays of 32 chars, and at output, the arrays are only composed of 8 chars.


0 Kudos
Message 3 of 6
(3,904 Views)
Well you don't have to create a CIN really but a wrapper DLL would be a great help. The CamName parameter is not easily done in LabVIEW and I really mean that NOT easily! If you have trouble to understand how it should be done in C there is absolutely no chance you will ever get it right in a way that does not involve creating an external code module such as a DLL or CIN. And there are several possible variations on how this would havve to be done, depending on what the API you try to call expects.

Abut CINs: they are old legacy technology and while they are not likely to go away in future versions of LabVIEW I do not expect support for them in possible future platform versions of LabVIEW such as Win64. Writing a DLL instead that translates between your DLL and more friendly LabVIEW data types will be a bit simpler to tackle since you don't have to deal with LabVIEW specific CIN pericles.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 6
(3,904 Views)
I succeeds with the .doc method. When I transformed the array in cluster, i didn't change the default size of cluster. Thanks !
0 Kudos
Message 5 of 6
(3,902 Views)

Could you please tell me if you can read the CamName and how did you do it?

 

Best regards,

0 Kudos
Message 6 of 6
(3,303 Views)