However when I compile my c++ code and run it through ahk it returns nothing at all.
C++
Code: Select all
int function(int value) {
float value2 = 0.5f;
return static_cast<int>(value * value2); //runs into a problem here and returns nothing
}
Code: Select all
inputbox,value,Enter Value,Enter integer Value ;simple input test
func := MCode("2,x86:g+wI20QkDNl8JAYPt0QkBtgNAAAAALQMZolEJATZbCQE2xwk2WwkBosEJIPECMOQAAAAPw==") ;compiled c++
msgbox % "Expected result of " value "/2 = " floor(value/2) "`ncompiled c++ returns:`n>" dllcall(func,int,value,"cdecl") "<"
MCode(mcode) //mcode function
{
static e := {1:4, 2:1}, c := (A_PtrSize=8) ? "x64" : "x86"
if (!regexmatch(mcode, "^([0-9]+),(" c ":|.*?," c ":)([^,]+)", m))
return
if (!DllCall("crypt32\CryptStringToBinary", "str", m3, "uint", 0, "uint", e[m1], "ptr", 0, "uint*", s, "ptr", 0, "ptr", 0))
return
p := DllCall("GlobalAlloc", "uint", 0, "ptr", s, "ptr")
if (c="x64")
DllCall("VirtualProtect", "ptr", p, "ptr", s, "uint", 0x40, "uint*", op)
if (DllCall("crypt32\CryptStringToBinary", "str", m3, "uint", 0, "uint", e[m1], "ptr", p, "uint*", s, "ptr", 0, "ptr", 0))
return p
DllCall("GlobalFree", "ptr", p)
}