jni-toolbox
this is a simple crate built around jni-rs to automatically generate JNI-compatible extern functions
it also wraps functions returning Result<>, making short-circuiting easy
usage
you must implement JniToolboxError trait for your errors, so that they can be converted to Java errors
you will need to define classes for them, and implement JniToolboxError returning the class path
alternatively, an exception class can be specified with the exception attribute
then just annotate your functions with
by specifying package and class, this crate will write an appropriate wrapper with the right function name. If inner function returns a Result<>, wrapper will also handle it. (currently just panics, soon will throw exceptions!)
note that input/output arguments must be natively FFI safe: there will be no hidden translations! you will have to un-marshal strings yourself
examples
the following function:
gets turned into this couple of functions:
pub extern "system"
status
this crate is rather early and intended mostly to maintain codemp java bindings, however it's also quite small and only runs at comptime, so should be rather safe to use