[Newbies] FFI and mpfr calls in squeak

LawsonEnglish LEnglish5 at cox.net
Thu Aug 13 10:11:38 UTC 2020

So I tested a simple mandelbrot set rendering algorithm using the ArbitraryPrecisionFloat package and it works just fine, but terribly slowly.

So I had the idea of using mpfr via FFI and find that I can’t even begin.

I’m getting the dreaded External module not found error and just can’t get rid of it.

I thought I was taking the easy route and simply copying the mpfr library into the Squeak all-in-one Resources directory but no matter what I try, that error pops up.

initPrecision: aDefaultPrecision
	“initialize default precision"

<cdecl: void 'mpfr_init' (long ) module:'libmpfr.6.dylib'>
	^self externalCallFailed 

This is roughly the “hello world” of using mpfr, I thought, but can’t even do that.

Now, waiting in the wings is a bigger problem, I think: the mpfr library uses the gmp library. So how does one do THAT with squeak? Compile both libraries into a single target? (yikes!).

That might be an issue later on, but the impression I’m getting is that squeak simply can’t find libmpfr.6.dylib, so errors that result from calling a second library from the first haven’t even popped up yet.

Squeak5.3-19435-64bit, Mac OS X 10.15.6



More information about the Beginners mailing list