News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

How many parameter I should push?

Started by Farabi, August 03, 2010, 05:27:12 AM

Previous topic - Next topic

Farabi

I make a dll function using C like this


typedef float GLvector4f[4]; // Typedef's For VMatMult Procedure
typedef float GLmatrix16f[16];

void  DLL_EXPORT VMatMult( GLmatrix16f M,GLvector4f v)
{
GLfloat res[4]; // Hold Calculated Results
res[0]=M[ 0]*v[0]+M[ 4]*v[1]+M[ 8]*v[2]+M[12]*v[3];
res[1]=M[ 1]*v[0]+M[ 5]*v[1]+M[ 9]*v[2]+M[13]*v[3];
res[2]=M[ 2]*v[0]+M[ 6]*v[1]+M[10]*v[2]+M[14]*v[3];
res[3]=M[ 3]*v[0]+M[ 7]*v[1]+M[11]*v[2]+M[15]*v[3];
v[0]=res[0]; // Results Are Stored Back In v[]
v[1]=res[1];
v[2]=res[2];
v[3]=res[3]; // Homogenous Coordinate
}


And Im going to call it using ASM. How many parameter I should push?
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

ecube

looks like 2? but you may want to define it with the stdcall calling convention, as that is just cleaner overall.

Farabi

I used extern "C" code, if I used __stdcall there are mangling there.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

Twister

Would it be best just to use pointers as parameters? You only have to push two parameters that way.