Getting "UnsatisfiedLinkError" in io_uring for methods that were defined as "static inline" in the header
Gavin Ray
ray.gavin97 at gmail.com
Wed Sep 21 22:39:11 UTC 2022
Ahh okay, thank you.
> In general inline functions (and function-like macros) are not true
library symbols, so there's not much the Linker can do for them.
> If you need to access these, you would need a native library wrapper
which exposes them as regular symbols.
That makes sense -- I will look at patching liburing with a dirty one-liner
that strips "static inline" from the definitions that have them then, ty =)
Do you anticipate any issues with using in/out-pointers as things get
passed back and forth from native to Java?
I tried to write a draft of how I think the translation of a "hello world"
io_uring program should be:
:https://gist.github.com/GavinRay97/8ea0997693c00f8df61968a98ba30135#file-io_uring-java
(The C version at the bottom is canonical/definitely works)
On Wed, Sep 21, 2022 at 5:13 PM Maurizio Cimadamore <
maurizio.cimadamore at oracle.com> wrote:
> Hi Gavin,
> thanks for the question - actually this might trip up others as well, so
> it's always good to ask here.
>
> I believe this has been fixed recently:
>
> https://github.com/openjdk/jextract/pull/70
>
> But the binary snapshots do not contain this fix.
>
> In general inline functions (and function-like macros) are not true
> library symbols, so there's not much the Linker can do for them.
>
> If you need to access these, you would need a native library wrapper which
> exposes them as regular symbols.
>
> (we'd like, at some point, to automate the wrapper generation in jextract).
>
> Maurizio
> On 21/09/2022 20:35, Gavin Ray wrote:
>
> I'm not super familiar with how linking and symbols work
>
> The liburing header is weird, it contains a mix of definitions:
> https://github.com/axboe/liburing/blob/master/src/include/liburing.h
>
> Some of them are traditional header defs, like:
>
> int io_uring_queue_init(unsigned entries, struct io_uring *ring, unsigned
> flags);
>
> But there are a lot of them which are defined like this:
>
>
> static inline int io_uring_wait_cqe(struct io_uring *ring, struct
> io_uring_cqe **cqe_ptr)
>
> Using "objdump" on the ".so", I can see that none of these "static inline"
> functions appear
>
> I have an almost-working test of using io_uring purely through Panama
> here, but it fails due to the above:
>
> https://github.com/GavinRay97/panama-liburing/blob/82f83a247bb78c26d787992fca28ea1b951dfd3c/lib/src/test/java/panama/liburing/LibraryTest.java#L25-L59
>
> How are you meant to be able to use these from the Foreign Memory API?
> Do I need to write a second library and built it, that re-exports these?
>
> Thanks, and sorry for so many newbie questions
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20220921/7707c5ef/attachment-0001.htm>
More information about the panama-dev
mailing list