Hi,
I need to send an array of structure to a C function (compiled as DLL). All is ok if I try to send only this struct (DllStructCreate + DllStructSetData).
At this time, my AutoIt code use a 2Darray (see 'test.au3' and $AliasList). I need to share this 2D array (in fact an array of struct, see 'global.h') between AutoIt and DLL. Each of them should be able to modify this array of struct.
I have done an small function (see 'MyFunction.c') that works fine but only with the first element of this array of struct.
I create the structure, assign an item to something, and call the dll.
1st test :
==> only 'AliasList[0]' is providen, and 'AliasList[0].ScenarioName' return correct value --> all is ok (and dll can update this value, perfect !)
2nd test (3rd in providen 'test.au3')
I try to send whole 2D array, and what ? Nothing good...
Does someone could help me please ? Maybe it's a wrong call, or an wrong C declaration, or both, or something else, but I cannot found what...
I think also my 2D array in AutoIt should be rewritten to match the array of struc in C-style.
Makefile providen (just rename txt to bat)
Dll (x86 & x64) compiled providen in ZIP file if you don't want to compile it.
Thanks in advance
Best Regards
I need to send an array of structure to a C function (compiled as DLL). All is ok if I try to send only this struct (DllStructCreate + DllStructSetData).
At this time, my AutoIt code use a 2Darray (see 'test.au3' and $AliasList). I need to share this 2D array (in fact an array of struct, see 'global.h') between AutoIt and DLL. Each of them should be able to modify this array of struct.
I have done an small function (see 'MyFunction.c') that works fine but only with the first element of this array of struct.
__declspec(dllexport) int MyFunction(char *Channel,struct Alias AliasList[],int AliasListLength) { fprintf(stdout,"Channel = %s\n",Channel ); fprintf(stdout,"AliasListLength = %d\n",AliasListLength ); fprintf(stdout,"AliasList[0].ScenarioName = %s\n",AliasList[0].ScenarioName); fprintf(stdout,"AliasList[1].ScenarioName = %s\n",AliasList[1].ScenarioName); fprintf(stdout,"AliasList[2].ScenarioName = %s\n",AliasList[2].ScenarioName); fprintf(stdout,"AliasList[3].ScenarioName = %s\n",AliasList[3].ScenarioName); fprintf(stdout,"AliasList[4].ScenarioName = %s\n",AliasList[4].ScenarioName); fflush(NULL); return(0); }
I create the structure, assign an item to something, and call the dll.
1st test :
[ autoit ]
Local $struct = DllStructCreate("...") DllStructSetData($struct,2,"this is my question") DllCall("./MyCustomDll_x64.dll","int:cdecl","MyFunction","str","file12345678","struct*",DllStructGetPtr($struct),"int",$NB_ITEM)
2nd test (3rd in providen 'test.au3')
[ autoit ]
DllCall("./MyCustomDll_x64.dll","int:cdecl","MyFunction","str","file12345678","ptr*",$AliasList,"int",$NB_ITEM)
Does someone could help me please ? Maybe it's a wrong call, or an wrong C declaration, or both, or something else, but I cannot found what...
I think also my 2D array in AutoIt should be rewritten to match the array of struc in C-style.
Makefile providen (just rename txt to bat)
Dll (x86 & x64) compiled providen in ZIP file if you don't want to compile it.
Thanks in advance
Best Regards