I'm consuming a C library in Java with GraalVm and I have this field (if_name) I don't know how to implement:
# define IFNAMSIZ 16
struct port_t
{
char if_name[IFNAMSIZ];
}
This is my current code:
@CStruct("port_t")
interface Port extends PointerBase {
@CField("if_name")
WordPointer getIfName();
@CField("if_name")
void setIfName(WordPointer ifName);
}
Using WordPointer I get the following error compiling:
Error: Type WordPointer has a size of 8 bytes, but accessed C value has a size of 16 bytes; to suppress this error, use the annotation @AllowNarrowingCast
I already tried with CCharPointer and CCharPointerPointer but those have fixed lengths to 8 bytes and I got a similar error when compiling.
Anyone can help? Thanks in advance