Are there plans to have an option for jextract to create an optimized binding?

Christoph Läubrich laeubi at laeubi-soft.de
Thu Mar 9 11:46:40 UTC 2023


Hi Maurizio,,

that already looks promising!

Would be cool if jextract could even automate this, so it finds the 
symbols from existing class files?

I can think about the following:

1) I generate all bindings
2) I have my code and test finished, and run jextract again, passing it 
my jar file
3) I get a binding with only things required.

because for a complex binding I can think its quite hard to find out 
what I don't care about.

Am 09.03.23 um 12:18 schrieb Maurizio Cimadamore:
> Hi Christoph,
> note that jextract already supports a filtering mechanism. The basic 
> usage is described here:
> 
> https://github.com/openjdk/jextract#filtering-symbols
> 
> That is:
> 
> 1. you can run jextract in a way so that it dumps all the symbols it 
> could find during its execution (--dump-includes=<filename>)
> 2. you can then edit the generated file, and drop all the symbols your 
> application doesn't care about
> 3. you can pass the edited file back to jextract, as an "argfile" e.g. 
> "@<filename>"
> 
> This will only generate bindings for the things you care about.
> 
> Hope this helps
> 
> Maurizio
> 
> 
> On 09/03/2023 11:05, Christoph Läubrich wrote:
>> Hi Panama Devs,
>>
>> I hope the mailinglist is the right place for such 
>> questions/discussions/ideas, as the github repository has not enabled 
>> Github-Discussions.
>>
>> jextract is doing a great work, but for some libs it produces a very 
>> very large result ( ~ 3000 files or more), I therefore wonder if it 
>> would be possible to have jextract passing some code (e.g. a jar) 
>> using the binding and then it generates an optimized binding that only 
>> contains the functions/constants that are actually used in the java code?
>>
>> thank in advance,
>> Christoph


More information about the panama-dev mailing list