[External] : Re: Growing jextract

Jorn Vernee jorn.vernee at oracle.com
Tue Feb 20 20:54:50 UTC 2024


Hey Manuel,

You should be able to use the ':' prefix to the library you pass to -l 
to specify a path.

So, on Linux you should be able to use -l :libudev.so.1 and on Mac -l 
:|/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation|

Does that work?
Jorn

On 20/02/2024 21:29, Manuel Bleichenbacher wrote:
> 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 
> <https://urldefense.com/v3/__https://github.com/manuelbl/JavaDoesUSB/blob/jdk22/java-does-usb/jextract/README.md__;!!ACWV5N9M2RV99hQ!JZksYXAXMLHwazJaDbyPbj4eOkTSMvg9QhB8DCZNIMGWMA2Yo4jDTemgCsNg-3UPxHbee0Qg00WLEQt2Y0wZWXBha80y$>
>
> 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/fbf8bb0d/attachment-0001.htm>


More information about the jextract-dev mailing list