Yannick Posted October 5, 2007 Report Share Posted October 5, 2007 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 Quote Link to comment
Yannick Posted October 5, 2007 Author Report Share Posted October 5, 2007 i used this method http://forums.lavag.org/index.php?act=Atta...ost&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. edit : I succeeds with the .doc method. When I transformed the array in cluster, i didn't change the default size of cluster. Thanks ! Quote Link to comment
Rolf Kalbermatter Posted October 7, 2007 Report Share Posted October 7, 2007 QUOTE(Yannick @ Oct 4 2007, 03:18 AM) Hi,I have to send a structure to a dll, with a pointer to a char in. Here is the structure : 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 Quote Link to comment
hviewlabs Posted November 22, 2007 Report Share Posted November 22, 2007 Maybe, pointer functions newly available in 8.5 (and DLL Wizard that uses them in wrappers) can help: http://forums.lavag.org/index.php?showtopi...ost&p=38888 Quote Link to comment
hviewlabs Posted November 22, 2007 Report Share Posted November 22, 2007 Maybe, pointer functions newly available in 8.5 (and DLL Wizard that uses them in wrappers) can help: http://forums.lavag.org/index.php?showtopi...ost&p=38888 Quote Link to comment
Rolf Kalbermatter Posted November 23, 2007 Report Share Posted November 23, 2007 QUOTE(hviewlabs @ Nov 20 2007, 09:03 PM) Maybe, pointer functions newly available in 8.5 (and DLL Wizard that uses them in wrappers) can help:http://forums.lavag.org/index.php?showtopi...ost&p=38888 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 Quote Link to comment
Rolf Kalbermatter Posted November 23, 2007 Report Share Posted November 23, 2007 QUOTE(hviewlabs @ Nov 20 2007, 09:03 PM) Maybe, pointer functions newly available in 8.5 (and DLL Wizard that uses them in wrappers) can help:http://forums.lavag.org/index.php?showtopi...ost&p=38888 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 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.