Click to See Complete Forum and Search --> : return value in C code


Vadiu
November 3rd, 2004, 12:07 PM
I've made an assembly function in a C program. Now I'd like that function to return a value stored in AX, BX, CX, or DX. Does someone know how to do that?
Thanks...

indiocolifa
November 4th, 2004, 10:30 AM
Suppose the following function which is written by asm (this is very simple, just to show):


void asmcode ( int param1, int* result)
{
__asm {

mov ax, param1
mov bx, 2
add ax, bx
mov result, ax }
}


That loads AX with param1 value, BX with 2, does AX+BX->AX and returns the value of AX in result parameter.

Hope that helps.