File: test.h
typedef void (func)(int x, const void *addr);
$ jextract test.h
WARNING: Using incubator modules: jdk.incubator.foreign
In memory compilation failed: warning: using incubating module(s): jdk.incubator.foreign
func.java:16: error: variable addr is already defined in method ofAddress(MemoryAddress,ResourceScope)
return (int x, jdk.incubator.foreign.MemoryAddress addr) -> {
^
1 error
1 warning
$ jextract --source test.h
WARNING: Using incubator modules: jdk.incubator.foreign
$ cat func.java
// Generated by jextract
import java.lang.invoke.MethodHandle;
import java.lang.invoke.VarHandle;
import java.nio.ByteOrder;
import jdk.incubator.foreign.*;
import static jdk.incubator.foreign.ValueLayout.*;
public interface func {
void apply(int x, jdk.incubator.foreign.MemoryAddress addr);
static NativeSymbol allocate(func fi, ResourceScope scope) {
return RuntimeHelper.upcallStub(func.class, fi, constants$0.func$FUNC, "(ILjdk/incubator/foreign/MemoryAddress;)V", scope);
}
static func ofAddress(MemoryAddress addr, ResourceScope scope) {
NativeSymbol symbol = NativeSymbol.ofAddress("func::" + Long.toHexString(addr.toRawLongValue()), addr, scope);
return (int x, jdk.incubator.foreign.MemoryAddress addr) -> {
try {
constants$0.func$MH.invokeExact(symbol, x, (jdk.incubator.foreign.Addressable)addr);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
};
}
}
Names like "addr", "scope" used in FunctionalInterfaceBuilder can clash with identifiers from C headers.
typedef void (func)(int x, const void *addr);
$ jextract test.h
WARNING: Using incubator modules: jdk.incubator.foreign
In memory compilation failed: warning: using incubating module(s): jdk.incubator.foreign
func.java:16: error: variable addr is already defined in method ofAddress(MemoryAddress,ResourceScope)
return (int x, jdk.incubator.foreign.MemoryAddress addr) -> {
^
1 error
1 warning
$ jextract --source test.h
WARNING: Using incubator modules: jdk.incubator.foreign
$ cat func.java
// Generated by jextract
import java.lang.invoke.MethodHandle;
import java.lang.invoke.VarHandle;
import java.nio.ByteOrder;
import jdk.incubator.foreign.*;
import static jdk.incubator.foreign.ValueLayout.*;
public interface func {
void apply(int x, jdk.incubator.foreign.MemoryAddress addr);
static NativeSymbol allocate(func fi, ResourceScope scope) {
return RuntimeHelper.upcallStub(func.class, fi, constants$0.func$FUNC, "(ILjdk/incubator/foreign/MemoryAddress;)V", scope);
}
static func ofAddress(MemoryAddress addr, ResourceScope scope) {
NativeSymbol symbol = NativeSymbol.ofAddress("func::" + Long.toHexString(addr.toRawLongValue()), addr, scope);
return (int x, jdk.incubator.foreign.MemoryAddress addr) -> {
try {
constants$0.func$MH.invokeExact(symbol, x, (jdk.incubator.foreign.Addressable)addr);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
};
}
}
Names like "addr", "scope" used in FunctionalInterfaceBuilder can clash with identifiers from C headers.