cffi uses a ".h"-like description of the lib so the interaction with the lib does not need using the cffi that much.
Cython is a different language than python, which interacts well by C and can be compiled into a python module directly
There seems to be a consensus that cffi is a bit easier to develop and maitain than ctypes for large FFIs. The difference on performance isn't clear (see interoptopus FAQ).
Regarding Java:
jni crate allows to build dybnamic libraries which complies with the JNI. No (or very little) java code needs to be written.
JNA is the other way around, it's a Java module which can be used to directly use C dynamic libraries. (Then no specific code in rust, but Java code).
Automatic tools:
A rust framework, uniffi, exists, to automatically build binding packages in several languages, including Python and Kotlin. It makes use of a unique FFI representation files, which it then uses to build the binding packages, and mock rust code which respects the common declared format. For python it uses ctypes, for Kotlin JNA.
When we discussed we did not settle on a strictly Java-written package, but it seemd to me it was implied. I believe moving over to Kotlin would be okay though.
I don't know how idiomatic the generated packages can be, given we use some very rich data models. I'm particularily thinking about range maps, which will probably be clunky on all sides.
Another rust framework interoptopus offers to build bindings automatically.
It does not support Java compatible languages out of the bat, but claims that it would be very easy to implement.
A last crate, diplomat also offers the same service, but without any of our languages already implemented.
Summary concerning frameworks to bind our FFI. We want to maintain two binding packages: a Python compatible one and a Java compatible one.
Regarding Python, there are several ways to bind to a C FFI:
ctypes
descriptive api to interact with the libcffi
uses a ".h"-like description of the lib so the interaction with the lib does not need using thecffi
that much.Cython
is a different language than python, which interacts well by C and can be compiled into a python module directlyThere seems to be a consensus that
cffi
is a bit easier to develop and maitain thanctypes
for large FFIs. The difference on performance isn't clear (see interoptopus FAQ).Regarding Java:
jni
crate allows to build dybnamic libraries which complies with the JNI. No (or very little) java code needs to be written.JNA
is the other way around, it's a Java module which can be used to directly use C dynamic libraries. (Then no specific code in rust, but Java code).Automatic tools:
uniffi
, exists, to automatically build binding packages in several languages, including Python and Kotlin. It makes use of a unique FFI representation files, which it then uses to build the binding packages, and mock rust code which respects the common declared format. For python it usesctypes
, for KotlinJNA
.interoptopus
offers to build bindings automatically.diplomat
also offers the same service, but without any of our languages already implemented.