Search the Community
Showing results for tags 'CodeBlock'.
-
Hello, I would like to develop a DLL for autoit but I have some questions. I use Autoit 3.3.9.0beta and codeblock with mingw for the DLL part. I have the DLL, a external program developped in C to test this DLL and an autoit program to test this DLL. The DLL have only one function: addition to add two integer and return the result. This is part of my source code (I put the full project in attachment): int DLL_EXPORT addition(int integer1, int integer2) { return integer1 + integer2; } #define DLL_EXPORT __declspec(dllexport) #ifdef __cplusplus extern "C" { #endif int DLL_EXPORT addition(int integer1, int integer2); #ifdef __cplusplus } #endif local $hDll = DllOpen("LibTest.dll") $result = DllCall($hDll, "int:cdecl","addition", "int",3, "int",7) MsgBox(4096, "In AutoIt", "3 + 7 = " & $result & @CRLF & "error = " & @error) DllClose($hDll) ExitThe returned value on my DLL function is correct (=10) with my C test program but not in autoit (=0). The parameters is correctly passed to the DLL in both case (I display it in the DLL with a msgbox). I have tested with __stdcall and without. What is wrong with my code?When I use the __stdcall version, my DLL function name change to addition@8, why this? and how to avoid this? (sorry I not realy familiar with DLL development).I would like to call an autoit function in my DLL. I suppose I need to use the DllCallbackRegister to get a pointer on my autoit function and to pass it to a function in my DLL, like what it’s done in the Example of DllCallbackRegister with EnumWindows. But in my DLL how I call this pointer? Does I need a specific mechanism or I can call it like another C function pointer? And how to pass parameters to the autoit callback function and eventualy get a return value?Thank you for your help.dll.zip
- 7 replies
-
- Dll
- DllCallbackRegister
-
(and 1 more)
Tagged with: