1

I want to make Clojure/Java bindings for the EFL. JNA appears to require a lot of explicit struct mapping (Bridj does the same thing). JNI has Gluegen, so I thought that might be simpler.

Going with Gluegen & deciding the Elementary module would be a good place to start, I ran:

java -jar /usr/share/java/gluegen2.jar -I. $(pkg-config elementary --cflags) /usr/include/elementary-0/Elementary.h

...and quickly found I'd need to create a ton of header stubs ie > 29

I've got three questions:

  1. What's the fastest and easiest way to generate Java bindings for this project?
  2. If Gluegen, is there a program for generating salient header stubs?
  3. If JNA, is there a program for generating salient Pointer/Struct mappings?

Quick followup. It does appear that I can do some things out of the box with clojure-jna

user=> (use 'net.n01se.clojure-jna)
nil
user=> (jna-invoke Integer eina/eina_init)
1
user=> (jna-invoke String eina/eina_str_escape "They'll start going ripe on us pretty soon.")
"They\\'ll\\ start\\ going\\ ripe\\ on\\ us\\ pretty\\ soon."
user=> (vec (jna-invoke (class (into-array String [])) eina/eina_str_split "Calvin;Leoben;D'anna;Simon;Dora2;105Rl;Six;Daniel;Sharon" ";" 0))
["Calvin" "Leoben" "D'anna" "Simon" "Dora2" "105Rl" "Six" "Daniel" "Sharon"]
user=> (jna-invoke Integer eina/eina_shutdown)
0

1 Answer 1

1

JNAerator will generate bindings for you, for both JNA and Bridj.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.