Windows API Generator

Manuel Bleichenbacher manuel.bleichenbacher at gmail.com
Wed Jun 4 16:12:41 UTC 2025


Dear Panama team

Here is a project I would like to bring to your attention: Windows API
Generator (https://github.com/manuelbl/WindowsApiGenerator) generates Java
code for accessing the Windows API using the FFM API.

For the Windows API, it achieves something similar to jextract. Unlike
jextract, it does not process C header files. Instead, the generator
processes rich metadata curated by Microsoft. And it takes full advantage
of it...

The generator produces code for functions, structs, unions, callback
functions, constants, enumerations and COM interfaces. It adds the call
state capture parameter where necessary, produces code for structs of
variable size, automatically initializes the "cbSize" field etc. COM
objects can be called from Java, and they can be implemented in Java.
Constants do not just cover integer constants, but also strings, GUIDs,
DEVPKEYs and more.

The generator is easy to use as it is available both as a Maven and Gradle
plugin. And it is sufficient to specify a small number of functions and
structs in pom.xml or build.gradle. The related types such a function
parameter types or types referenced by structs will be added automatically.

For the Java Does USB project (https://github.com/manuelbl/JavaDoesUSB), it
has tremendously helped to remove manually written code that was beyond the
capability of jextract, and to simplify the code using variable size
structs and non-integer constants.

Regards
Manuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20250604/6c5353ac/attachment.htm>


More information about the panama-dev mailing list