My code looks like this
_declspec(naked) void
f(unsigned int input,unsigned int *output)
{
__asm{
push dword ptr[esp+4]
call factorial
pop ecx
mov [output], eax //copy result
ret
}
}
__declspec(naked) unsigned int
factorial(unsigned int n)
{
__asm{
push esi
mov esi, dword ptr [esp+8]
cmp esi, 1
jg RECURSE
mov eax, 1
jmp END
RECURSE:
dec esi
push esi
call factorial
pop esi
inc esi
mul esi
END:
pop esi
ret
}
}
Its a factorial function and I'm trying to output the answer after it recursively calculates the number that was passed in
But what I get returned as an output is the same large number I keep getting Not sure about what is wrong with my output, by I also see this error CXX0030: Error: expression cannot be evaluated
Thanks!