jextract and inline functions
Jorn Vernee
jorn.vernee at oracle.com
Fri Oct 13 04:59:19 UTC 2023
Hi Artem,
Usually inline functions are problematic since the function doesn't
appear in the shared library, so the JVM can not link against it.
However, it looks like liburing [1] also has an ffi-friendly version of
the library that does include all symbols in the shared library.
Looking at the liburing.h header file [2], this is achieved by only
conditionally defining functions as `static inline`. You should be able
to define `IOURINGINLINE` to an empty string using `-DIOURINGINLINE=`
(-D is a jextract option), and then jextract should pick up the function.
HTH,
Jorn
[1]: https://github.com/axboe/liburing
[2]:
https://github.com/axboe/liburing/blob/4b7a98ce3e766953eac1b18998d76d38dd9bff09/src/include/liburing.h#L37-L39
On 12/10/2023 22:27, Artem Ananev wrote:
> Hi, project Panama team,
>
> I use jextract to generate Java classes for liburing Linux library (a wrapper over IO_uring), the header is liburing.h Many functions in the header are "static inline”, and jextract skips them altogether. Some of them are one-liners and can be re-implemented in Java code, but some are quite complicated. What’s the recommended way to deal with such cases?
>
> Thanks,
> Artem
>
More information about the panama-dev
mailing list