[cfe-dev] Java bindings for clang/libclang?
alex at declera.com
Tue Nov 29 19:01:31 CST 2011
On 29.11.2011 23:51, Nathan Ridge wrote:
> I am wondering whether there exist Java bindings for libclang, or some other
> way to access the clang API from Java code (other than using JNI directly - I'm
> thinking of something like a Java wrapper library, possibly implemented using
Another JNA variant (besides Kevin suggestion for semi-automatic
generation of complete binding) might be straight-forward translation of
current FFI based bindings ($CLANG/bindings/python).
Or, you might test if it will be zippy enough with in-process JIT-ed
FFI/IPC instead of classical bindings:
libclang - LiaJIT FFI - msgpack - zeromq-INPROC:// - msgpack - java
At least, the FFI part will be faster than JNA or current Python FFI
bindings (because Python FFI is not JIT-ed to machine code). The size of
LuaJIT.so on x86_64 is about 400K.
This way advantages - a) Like JNA, easier (compared to JNI) following of
libclang evolution, but with possible better performance b) potential
direct reuse of your libclang as zeromq/msgpack service by other
projects and c) practical experience in the build server direction of
P.S. Also, you can use Python bindings via JPype for the initial
sketching (or generating other bindings).
More information about the cfe-dev