IronClad equivalent for Jython
-
01-07-2019 - |
Question
For IronPython there is a project - IronClad, that aims to transparently run C extensions in it. Is there a similiar project for Jython?
Solution
Keep an eye on JyNI (http://www.jyni.org), which is to Jython exactly what is Ironclad to IronPython. As of this writing JyNI is still alpha state though.
If you just want to use some C-library from Jython, simply use JNA from Jython like you would do from Java. If you need finer control, look at JNI or SWIG.
Also, you might want to take a look at JEP (https://github.com/mrj0/jep) or JPY (https://github.com/bcdev/jpy).
OTHER TIPS
You can probably use Java's loadLibrary to do that (provided it works in your platform's java). It is in the java library: java.System.loadLibrary().
Note that sometimes you will have to write a wrapper in C and/or in Java depending on the library you want to use and target system, since details are platform dependant. Refer to the documentation for more details.