Thank, i'm trued do this, and i'm got aBoxedFloat64 4.5879913020458836e-41 , which is still a very strange value
пн, 26 нояб. 2018 г. в 12:33, [email protected] <[email protected]>: > Hi, > > could be the problem that you are using the same external array for > both xm and ym?. > The clone message just creates a shallow copy of the external array. > It does not allocates a new external array, it only copies the address in > both xm and ym. > > You should better do something like this: > > xm := FFIExternalArray externalNewType: 'float' size: 2. > ym := FFIExternalArray externalNewType: 'float' size: 2. > > Cheers. > > On Mon, Nov 26, 2018 at 9:30 AM Yuriy Babah <[email protected]> > wrote: > >> 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? >> > > > -- > Pablo Tesone. > [email protected] >
