3

For IronPython there is a project - IronClad, that aims to transparently run C extensions in it. Is there a similiar project for Jython?

Mike Pennington
  • 41,899
  • 19
  • 136
  • 174
sumek
  • 26,495
  • 13
  • 56
  • 75

2 Answers2

1

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.

nosklo
  • 217,122
  • 57
  • 293
  • 297
  • Thanks for your answer, but it was not what I was looking for. Propably it means that there is no similiar project in the Jython world. – sumek Sep 23 '08 at 09:01
  • Maybe not what you were hoping for, but there is pretty much no other way to do it. Jython is locked up to what java can do. – nosklo Dec 04 '08 at 21:47
1

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).

stewori
  • 586
  • 4
  • 12
  • There is also JNR, which I forgot to mention. It is probably the better alternative to JNA as it is said to be much more performant. – stewori Jun 24 '15 at 14:56