Growing jextract

Manuel Bleichenbacher manuel.bleichenbacher at gmail.com
Tue Feb 20 20:29:04 UTC 2024


Hi Panama team

Thanks again for quickly addressing the issues. I was able to upgrade my
library to JDK 22 using the latest jextract version on all three platforms.

All issues that I have reported previously are fixed.


I've discovered one more issue. For a particular type (on macOS), jextract
creates code because a dependency was not specified. I guess it would be
supposed to abort with an error regarding the missing dependency. The
problem is quickly fixed if the dependency is included.

The minimal commands to reproduce it is:

JEXTRACT=../../../../jextract/build/jextract/bin/jextract
SDK_DIR=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk

$JEXTRACT --output ../../src/main/java \
  -I $SDK_DIR/usr/include \
  -lIOKit.framework \
  --header-class-name IOKit \
  --target-package net.codecrete.usb.macos.gen.iokit \
  --include-struct IOCFPlugInInterfaceStruct \
  iokit_helper.h

The file iokit_helper.h:

#include <IOKit/usb/IOUSBLib.h>
#include <IOKit/IOCFPlugIn.h>

The missing dependency is CFUUIDBytes and the path to it is that a typedef
(REFIID) referring to it is used in a parameter of a function pointer
(QueryInterface) of IOCFPlugInInterfaceStruct.


I notice that I don't use any "--include-typedef" anymore. Since jextract
resolves typedefs to the underlying type, only the referred struct needs to
be included. Is there any use left for "--include-typedef"?


The biggest annoyance is that the generated code still needs to be manually
modified (unless I've overlooked a jextract option). The details can be
found here:
https://github.com/manuelbl/JavaDoesUSB/blob/jdk22/java-does-usb/jextract/README.md

It's related to two cases of locating the library at run-time: referring to
major version 1 of libudev in Linux, and referring to a system framework on
macOS.

Regards
Manuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jextract-dev/attachments/20240220/5b785ad3/attachment.htm>


More information about the jextract-dev mailing list