Finally, it seems its impossible to pass double-floats to imported functions !
To pass floats, my final solution is:
create sfarr 32 sfloats allot
0 value nsf
: >parm ( nparm -- n*i )
to nsf
nsf 1+ 1 ?DO nsf i - sfloats sfarr + sf! LOOP
nsf 0 ?DO i cells sfarr + @ LOOP ;
Then...
\ import: float VectorMagnitude(float x, float y, float z);
3 IMPORT: VectorMagnitude ( x y z -- len )
\ use it as this
: VectorMagnitude \ N: ( x y z -- len ) \ S: --
3 >nparm VectorMagnitude nsf ! nsf sf@ ;
To pass double-floats, I have created a small .DLL with redefinitions to always use floats! - regretable solution!
Charles Melice
.
Received on Thu Feb 25 1999 - 08:47:56 PST
Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!
This archive was generated 09-Feb-2012. Archive updated nightly.