local experiment. FFI in bb. costs about ~3mb
Out of curiosity, what's the advantage of using Babashka FFI on the JVM vs using coffi directly?
you'll be able to run all the babashka libraries that use it on the JVM as well
OK. So cross-dialect usage. Nifty!
all libraries that are bundled in babashka can also be used in the JVM
so you can run on either host or you can develop using a JVM REPL + tooling if you wish so and then run with bb
In the next few weeks I’ll try to add this to https://github.com/willcohen/clj-native — currently does ffi cross-dialect between squint and jvm, it’d be cool to have bb as a third with this ffi underneath
e.g. this library is now runnable from both bb (master) and JVM: https://github.com/babashka/babashka.sqlite
cool
cool! about struct by values, why does it require libffi? wouldn't StructLayout work?
Yes that works but in native-image struct downcalls have to be registered at build time. libffi is a way around that. registering all kinds of struct downcalls at build time would be a combinatorial explosion.
libffi is only needed in a native-image and it's statically linked so no need to install it alongside bb. in the JVM it isn't required (I'm updating this now)