Using D to program to the Java Native Interface
I've been looking at the D programming language and it looks like a lot of fun to try for someone already开发者_JAVA百科 proficient in C++.
Can I use D to program to the Java Native Interface which is a C interface?
I don't know much about the JNI, but for functions declared extern(C)
, and using only C datatypes, D matches the C ABI, so the JNI should not even know the difference. You probably just need to translate a few headers to D, which can be partially automated with the htod utility.
I'm pretty sure it's possible (I have used D and C++/JNI).
You'd have to convert the JNI headers to D, and as JNI is ABI agnostic these headers don't even change much with new JDK releases.
The annoying part is that the javah utility does not generate D header files .di
精彩评论