-
C TO asm [NASM]
I am stuck - i cannot find answer in google or any where else -
how can I pass values to my C code from asm ??
I am compiling my both C code and ASM code to .obj file and linking the mess together . but i cannot find a way pass values to my c code and return value
Thx for help
-
Re: C TO asm [NASM]
The EAX register is commonly where values are stored on 32-bit machines once a function has returned.
So,
Code:
; ASM
ASMFunction proc
mov eax, 1234
ASMFunction endp
// C
void CFunction()
{
int blah = ASMFunction();
}
Passing values to functions is simple enough.. you just need to make sure the data types are the same size/type:
Code:
; ASM
AddASM proc
LOCAL arg1:DWORD,arg2:DWORD
pop arg2
pop arg1
add arg1, arg2
mov eax, arg1
ret
AddASM endp
// C
void AddC(int num1, int num2)
{
return AddASM(num1, num2);
}
chem
-
Re: C TO asm [NASM]
:D THX
how i pass values from my asm to my C code ??
-
Re: C TO asm [NASM]