RFR: 7904073: Derive required symbols from client code to minimize generated bindings

Jorn Vernee jvernee at openjdk.org
Thu Oct 2 16:27:12 UTC 2025


On Wed, 3 Sep 2025 15:49:24 GMT, Nizar Benalla <nbenalla at openjdk.org> wrote:

> Please review this change to add a small sample that extracts full bindings once, scans the compiled client classes to collect actually referenced symbols, filters the includes list, and re-runs jextract to produce a slim binding set.

This fell off my radar, sorry.

samples/opengl-minimal-bidings/Teapot.java line 76:

> 74:         try (var arena = Arena.ofConfined()) {
> 75:             var argc = arena.allocateFrom(C_INT, 0);
> 76:             glutInit(argc, argc);

Second argument shouldn't be `argc`, bu a pointer to `argv` (https://www.opengl.org/resources/libraries/glut/spec3/node10.html). 

I think the other sample also gets this wrong, but I think it works out because we pass `0` as `argc`.

samples/opengl-minimal-bidings/run_windows.ps1 line 10:

> 8:   --enable-native-access=ALL-UNNAMED `
> 9:   -D"java.library.path=C:\Windows\System32`;$freeglutPath\bin\x64" `
> 10:   Teapot.java

I suggest just removing the Windows scripts, as it looks like the filtering script only work on Mac.

-------------

Marked as reviewed by jvernee (Reviewer).

PR Review: https://git.openjdk.org/jextract/pull/288#pullrequestreview-3295339847
PR Review Comment: https://git.openjdk.org/jextract/pull/288#discussion_r2399327878
PR Review Comment: https://git.openjdk.org/jextract/pull/288#discussion_r2399321989


More information about the jextract-dev mailing list