I know that is better to use Python to call Posix and Win API, but I would like to know if there is a not so painful way to call C APIs from Groovy, or at least with Java.
+2
A:
The official way to invoke the native platform (implicitly, all C/C++ code) from Java is via JNI. I wouldn't call this "not so painful".
You could look into getting SWIG to generate most of the nasty code for you, I've used it a couple of times to wrap some of my own C code with some success. I was forced "handle-ize" some of my code to make the resulting Java readable, however.
An option I've read about, but never personally used, is JNA. It looks like less work than JNI, but I can't vouch for it.
These solutions are all Java-centric, but I don't see why you couldn't then make use of them in any JVM hosted language.
Kevin Montrose
2009-07-09 17:20:23