[External] : Re: jextract and inline functions
Jorn Vernee
jorn.vernee at oracle.com
Tue Oct 17 07:14:11 UTC 2023
Hi Artem,
There should be another liburing-ffi.so.x library that contains all the
symbols. This feature was added in liburing 2.4 which was released on
June 9th [1], [2]. So, I guess perhaps it has not been adopted by your
distro yet?
Jorn
[1]:
https://github.com/axboe/liburing/commit/9e2890d35e9677d8cfc7ac66cdb2d97c48a0b5a2
[2]: https://github.com/axboe/liburing/releases/tag/liburing-2.4
On 17/10/2023 02:45, Artem Ananev wrote:
> 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://urldefense.com/v3/__https://github.com/axboe/liburing__;!!ACWV5N9M2RV99hQ!IVL8Dxax2rGC67prDk6wa53lRBbYDKLrwv8JijpIt_3PX7EePz9e_kZIkVlYSr5Ls7HlGWbtQ2OwnkXNyH50dYK5frJo$
>> [2]: https://urldefense.com/v3/__https://github.com/axboe/liburing/blob/4b7a98ce3e766953eac1b18998d76d38dd9bff09/src/include/liburing.h*L37-L39__;Iw!!ACWV5N9M2RV99hQ!IVL8Dxax2rGC67prDk6wa53lRBbYDKLrwv8JijpIt_3PX7EePz9e_kZIkVlYSr5Ls7HlGWbtQ2OwnkXNyH50df9-nfZc$
>>
>> 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