Jump to content

char pointer in a stucture for dll


Recommended Posts

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

Link to comment

QUOTE(Yannick @ Oct 4 2007, 03:18 AM)

Duplicate post, see http://forums.ni.com/ni/board/message?board.id=170&message.id=276066#M276066' target="_blank">here.

The explanation in that post for string pointers inside a structure is wrong. It won't work like that without extra measures. Depending on the DLL it may crash immediately, corrupt some memory silently and crash later on, but something will go wrong sooner or later.

Rolf Kalbermatter

Link to comment
  • 1 month later...

QUOTE(hviewlabs @ Nov 20 2007, 09:03 PM)

Try to use the library import wizard in 8.5. It can do some of these things for not to complicated structures, but if that does not work those functions won't help you magically. You will have to understand at least as much about C and pointers in C as you would need to write your own wrapper DLL in C to deal with that in a more clean and much easier to maintain manner.

Rolf Kalbermatter

Link to comment

QUOTE(hviewlabs @ Nov 20 2007, 09:03 PM)

Try to use the library import wizard in 8.5. It can do some of these things for not to complicated structures, but if that does not work those functions won't help you magically. You will have to understand at least as much about C and pointers in C as you would need to write your own wrapper DLL in C to deal with that in a more clean and much easier to maintain manner.

Rolf Kalbermatter

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.