I tried this process starting from the example and everything worked fine.
However, as soon as I invoke a method from a custom referenced (additional) DLL, the DllCall() fails, returning ErrorLevel 0xe0434f4d, LastError 2.
Do I need to do something special to utilize additionally referenced DLLs (not directly accessed by AHK)?
AHK:
Code:
MsgBox % DllCall("aQueryWrapper.dll\echo", "Str", "lol this really works", "Cdecl Str")
MsgBox % ErrorLevel " / " A_LastError
MsgBox % DllCall("aQueryWrapper.dll\query", "Str", "192.168.1.198:27015", "Cdecl Str")
MsgBox % ErrorLevel " / " A_LastError
Call chains:
aQuery.ahk DllCall() -> aQueryWrapper.dll\echo()
aQuery.ahk DllCall() -> aQueryWrapper.dll\query() -> aQueryLib.QueryGameServer()
The call to echo() is verbatim copied from the sample code in the first post. The call to query() uses an identical type signature as echo().
The call to echo() works perfectly (ErrorLevel=0). As soon as I hit the call in query() to the additional referenced DLL I get the failure. If I remove everything from the function that references this DLL, it executes fine.
The weird thing is I have written a C# console test app, and calling query() from there, with the exact same arguments, works fine there. In fact I went so far as to hardcode default arguments into the beginning of query(), thus ignoring passed arguments entirely. The console app continues to work and DllCall() continues to fail.