Hi !

I'm trying to call a very simple function from C ++ lib, writed for the
test.
function with prototype:

extern "C" float interpolationFunc(float* xm, float* ym, int size, float x).

In Pharo7 wrote:
FFIExamples class >> interpolationFunc_xm: xM ym: yM size: size x: x
    ^ self ffiCall: #(float interpolationFunc #(float * xM , float * yM ,
int size , float x)) module: 'libinterpolationLib.so'

in Playground i'm doing:
xm :=  FFIExternalArray externalNewType: 'float' size: 2.
ym := xm clone.
#(2 3) doWithIndex: [:each :i | xm at: i put: each].
#(3 4) doWithIndex: [:each :i | ym at: i put: each].
FFIExamples interpolationFunc_xm: xm pointer ym: ym pointer size: 2  x: 2.5
.

last expression returninп me 0.0, but right is 3.5.

I'm dit the same in Python3 ctypes, and there work's fine.

In UnifiedFFI booklet is absent chapter "Arrays", anybody may help with
whot i'm doing wrong?

Reply via email to