I'm trying to interface with a C shared library that uses floating point numbers. It seems that the C function isn't taking arguments from either the float stack or the data stack.
First, the file testfloat.c contains one line:
extern float cadd( float a, float b) {return a + b;}
I compile with: gcc -shared -o testfloat.so testfloat.c
Here's my test session:
VFX Forth 64 5.20 [build 0131] 2022-09-12 for Linux x64
© MicroProcessor Engineering Ltd, 1998-2022
Library: ./testfloat.so ok
Extern: float "C" cadd( float a, float b ); ok
3.14159e0 fs@ ok-1 F:-1
2.71828e0 fs@ ok-2 F:-2
f.s ( check the stacks before calling )
-- FP top of 2
2.71828
3.14159
ok-2 F:-2
.s
DATA STACK
top
0 0000:0000:0000:0000
0 0000:0000:0000:0000
ok-2 F:-2
cadd ok-2 F:-2 ( call the C function )
f.s
-- FP top of 2
2.71828
3.14159
ok-2 F:-2
.s
DATA STACK
top
0 0000:0000:0000:0000
0 0000:0000:0000:0000
ok-2 F:-2