Jump to content

Recommended Posts

Posted

Hi guys,

I wrote a DLL so I can speed-up some math-intensive calculations I was doing in AutoIT. The DLL works when called from a C++ program, but in AutoIT it crashes.

Here are the 2 DLL functions:

__declspec(dllexport) __int32 __cdecl DLL13 (void)  // Just return int 13
{ return 13; }

__declspec(dllexport) __int32 __cdecl DLLADD (__int32 a, __int32  // return int a+b
{ return a + b; }

 

And this is how I call them:

Local $hDLL1 = DllOpen ( "AutoIT.dll" )
MsgBox (0, "", $hDLL1)
MsgBox (0,"", DllCall ($hDLL1, "long", "DLL13"))
MsgBox (0,"", DllCall ($hDLL1, "int", "DLLADD", "int", 4, "int", 8))

The first MsgBox prints "1"

The second MsgBox prints ""

The third MsgBox crashes the program.

Any thoughts on what could be wrong? Thanks.

Posted

Thanks Universalist. I can't believe I missed that section. :  I changed it to this and now it works

Local $a = DllCall ($hDLL1, "int:cdecl", "DLLADD", "int", 4, "int", 8)
MsgBox (0,"", $a[0])

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...