File: t.h
void (*f)(int);
The generated f.java looks as follows:
public interface f {
void apply(int _x0);
static MemorySegment allocate(f fi, MemorySession session) {
return RuntimeHelper.upcallStub(f.class, fi, constants$0.f$FUNC, session);
}
static f ofAddress(MemorySegment addr, MemorySession session) {
MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, session);
return (int __x0) -> {
try {
constants$0.f$MH.invokeExact((MemorySegment)symbol, __x0);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
};
}
}
Note the redundant cast in the line:
constants$0.f$MH.invokeExact((MemorySegment)symbol, __x0);
void (*f)(int);
The generated f.java looks as follows:
public interface f {
void apply(int _x0);
static MemorySegment allocate(f fi, MemorySession session) {
return RuntimeHelper.upcallStub(f.class, fi, constants$0.f$FUNC, session);
}
static f ofAddress(MemorySegment addr, MemorySession session) {
MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, session);
return (int __x0) -> {
try {
constants$0.f$MH.invokeExact((MemorySegment)symbol, __x0);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
};
}
}
Note the redundant cast in the line:
constants$0.f$MH.invokeExact((MemorySegment)symbol, __x0);