Some small feedback regading jextract as a user

Jerven Tjalling Bolleman Jerven.Bolleman at sib.swiss
Thu Nov 12 20:47:18 UTC 2020


Dear panama-devs,

I hope this feedback is in the useful category. My feedback is regarding 
the jextract tool and ffi. Most of it is trivial but I hope it is still 
useful.

No --version or -v option to quickly get the exact version of jextract 
(would make future feedback easier to pinpoint).

Assume the jextract user has minimal or no knowledge (like me) of how 
the library they want to wrap was built. For example the first error I 
ran into was “fatal error: 'cstdarg' file not found” which required “-C 
-x -C c++” to be added to the command. This was not intuitive and 
certainly not the first thing I tried (I started with trying different 
-I combinations. Specifically, I am trying to wrap a rust library with a 
header generated by rust cbindgen. So thinking of needing to add clang 
options to jextract was not high on my lists of things to do.

Having fixed that I ran into a null pointer exception. i.e.
WARNING: Using incubator modules: jdk.incubator.jextract, 
jdk.incubator.foreign
java.lang.NullPointerException

While we might dislike stack traces. I think a bug report (to myself 
regarding the C code) or to you would be easier to work on when you have 
a stack trace.

When generating the helloworld example I needed to compile with -fPIC. 
Which the document at
https://github.com/openjdk/panama-foreign/blob/foreign-jextract/doc/panama_jextract.md#jextract-a-jar-file-for-helloworldh 
claims generates a jar file but actually generates a directory with 
class files. The example worked fine with clang 10.0.1 but my fedora 
10.2.1 gcc needed -fPIC.

Regarding the FFI interface, I would love to see more examples regarding 
the group layout functionality.

Otherwise with jextract I quite quickly ran into error: unknown type 
name without much of a suggestion why a certain type was not known. The 
libraries added to the command line should have had the types. And I am 
still working on this one.

That said the tools have lots of promise and please keep working on 
them!

Regards,
Jerven




-- 
Jerven Tjalling Bolleman
SIB | Swiss Institute of Bioinformatics
CMU - 1, rue Michel Servet - 1211 Geneva 4
t: +41 22 379 58 85 - f: +41 22 379 58 58
Jerven.Bolleman at sib.swiss - http://www.sib.swiss



More information about the panama-dev mailing list