(Sorry if this is a common topic or is in the wrong board ive tried searching to no solution)
I have the below assembly routine (computes e^X - 58 cpu clock cycles on an athalon - I would be impressed if someone could find a faster routine ) written in MASM syntax, and I no matter what I try I cannot manage to be able to use it from my C++ source.
I have declared:
-e_pwX PROTO : DWORD (In Assembly Source)
-PUBLIC e_pwX
&
-extern void e_pwX(FLOAT *); (In C++ Source)
And assembled the assembly source into a (COFF) object binary and included this file in the linker command line but when trying to compile I get this error:
[Linker error] undefined reference to `e_pwX(float *)'
My somewhat limited understanding of C++ doesn't help either but I will be grateful for any suggestions.
-Cheers
The routine:
Code:
e_pwX PROC C lpFloat: DWORD
fld [lpFloat]
sub esp,16
fldl2e
fmul ; z = x*log2(e)
fist DWORD PTR [esp+12] ; round(z)
fld1
fstp TBYTE PTR [esp]
fisub DWORD PTR [esp+12] ; z - round(z)
mov eax, [esp+12]
add [esp+8],eax
f2xm1
fld1
fadd ; 2^(z-round(z))
fld TBYTE PTR [esp] ; 2^(round(z))
fmul ; 2^z = e^x
add esp,16
fst [lpFloat]
ret
e_pwX ENDP