Skip to content

Cannot JNAerate headers that correspond to multiple shared libs #518

@octachoron

Description

@octachoron

Hi,

I ran into an oddity about GLib that, as far as I can tell, JNAerator cannot handle. In RHEL6 amd64's GLib 2.28.4-1, some of the functions declared in gthread.h (e.g. g_thread_init() ) are defined in libgthread-2.0.so as expected, but some are not. For example, g_thread_join() is defined in libglib-2.0.so. This unsurprisingly leads to BridJ being unable to get the address of the problematic methods, and an UnsatisfiedLinkError when trying to use one of them.

While the @Library annotation in BridJ could, in theory, be applied to methods as well, with JNAerator's -library option the finest adjustment is on a per-header basis. The above example shows that this does not cover all cases. I can't think of a way to tell the correct library from the header only, but it would be useful if there was a way to specify the native library on a per-method basis in the JNAerator config file. The approach I have in mind is that a script could probe the shared libs with nm -D, and generate a section of the JNAerator config file, with options for the problematic functions, based on the results.

Thanks for any help with this issue in advance!

Cheers

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions