How to declare "extern" field with graalvm.nativeimage

Viewed 84

I'm interacting with a C library in a Java application using GraalVm. This library uses a field to store the error messages value triggered by the functions. I need to know how to declare it in my GraalVm class to access it.

C code:

typedef struct {
    int err_no;
    char *msg;
} ttErr;

extern ttErr tt_err;

Java code:

@CStruct("ttErr")
public interface TtErr extends PointerBase {

    @CField("err_no")
    int getErrNo();

    @CField("err_no")
    void setErrNo(int errNo);

    @CField("msg")
    CCharPointer getMsg();

    @CField("msg")
    void setMsg(CCharPointer msg);
}

@????("tt_err") //How to declare this? 
TtErr ttErrAccessor;

Thanks in advance

0 Answers
Related