I have tried out what you suggested all.
And it works.
I also make tried out other combinations so the conlusion:
__stdcall is not neccessary as it is the default, the compiler implicitly use it. (But obviously worthy to use it)
extern "C" is not neccessary. To export the function the definition file is enough.
Definition file is neccessary, if there is not definition file, the extern "C" or __declspec(dllexport) is useless.
thx for help, bb.
Now the example of the working DLL
#include "Mathy.h"
#include <stdexcept>
int Addy(int a, int b)
{
return a + b;
}
// Mathy.h
int Addy(int a, int b);
EXPORTS
Addy
The Autoit source
Dim $result[50]
$dll = DllOpen("MathyDll.dll")
MsgBox ( 0, "Error Code, MathyDll.dll: ", @error )
$result = DllCall($dll, "int", "Addy", "int", 5, "int", 6 )
MsgBox ( 0, "Error Code", @error )
msgbox(0, "Res0", $result[0]) ; number of chars returned
msgbox(0, "Res1", $result[1]) ; Text returned in param 2
Exit