[foreign-jextract] No code generated for structs inside union

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Aug 6 14:27:20 UTC 2020


On 06/08/2020 14:25, Filip Krakowski wrote:
> Hi,
>
> it seems that jextract does not generate code for structs declared 
> within unions. Tested with "ibv_send_wr" shown on the following man page.
>
> https://linux.die.net/man/3/ibv_post_send
>
> Although it is possible to get a MemorySegment for "wr", it's rather 
> difficult to work with it without having its corresponding 
> MemoryLayout. In this case it is relatively important to access the 
> fields of the structs in the union, as these describe how an operation 
> is to be executed.

Yeah - this seems a bug.

It's not just unions - even nested structs are not handled correctly:

struct Foo {
    struct {
       int x;
       int y;
    } field;
};

Here there's just a getter/setter for "field". Seems like jextract does 
not recurse on nested structs/unions.

Ideally we should have bulk getter/setters (e.g. "field"), as well as 
dedicated field getter setters (e.g. "field.x"), either in same Foo 
interface, or in separate interfaces.

Maurizio

>
> Best regards,
> Filip


More information about the panama-dev mailing list