jextract and inline functions

Artem Ananev artem.ananev at swirldslabs.com
Tue Oct 17 00:45:38 UTC 2023


Hi Jorn,

Thank you for the hint, I tried that, but it didn’t work. I can’t find `IOURINGINLINE` define in liburing.h header or any related files. Even if such a define existed, I believe the dynamic library (liburing.so.X) still doesn’t have these symbols. jextract could probably process the headers, but it would still fail in runtime. It would only work, if there was a different variant of liburing.so There is nothing like that in my linux distro (ubuntu 22.04)

Thanks,
Artem

> On Oct 12, 2023, at 9:59 PM, Jorn Vernee <jorn.vernee at oracle.com> wrote:
> 
> 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