Problem about different behaviour when running compiled/uncomplied can be (maybe) different implicit 32/64 bit mode. 32/64 bit mode is important when you call external DLL functions by DllCall(). Your EXE must be the same 32/64 bit type as external DLL. To avoid this problem use explicit compilator option (force 32bit compilation when using 32bit DLL) : #AutoIt3Wrapper_UseX64=n or #pragma compile(x64, False)