I noticed that the April 30th build no longer has an "Known Issues" section like previous release.
But I seems still have problem trying to compile some Vulkan header due to bitfield and other C struct not supported. Does anyone have some idea on the status of Jextract?
WARNING: Skipping VkAccelerationStructureSRTMotionInstanceNV.flags (bitfields are not supported)
WARNING: Skipping VkMicromapEXT_T (type Declared(VkMicromapEXT_T) is not supported)
WARNING: Skipping VkOpticalFlowSessionNV_T (type Declared(VkOpticalFlowSessionNV_T) is not supported)
WARNING: Skipping VkShaderEXT_T (type Declared(VkShaderEXT_T) is not supported)
Error message looks like this.
I was expecting the Jextract to work since they remove the known issues section in new release note.
Update: some experiment with GLFW3 and result
import java.lang.foreign.*;
import org.glfw3.java.*;
class GLFW_Java {
public static void main(String[] args) {
System.loadLibrary("glfw3");
System.out.print("Start");
glfw3_h.glfwInit();
try (Arena arena = Arena.ofConfined()) {
String window_name_javaString = "Simple Example";
MemorySegment window_name_C = arena.allocateFrom(window_name_javaString);
MemorySegment window = (MemorySegment)
glfw3_h.glfwCreateWindow(640, 480, window_name_C, null, null);
if (window != null) {
System.out.print(window);
}
}
}
}
Error Message:
Exception in thread "main" java.lang.AssertionError: should not reach here
at org.glfw3.java.glfw3_h.glfwCreateWindow(glfw3_h.java:4721)
at GLFW_Java.main(GLFW_Java.java:14)
Caused by: java.lang.NullPointerException
at org.glfw3.java.glfw3_h.glfwCreateWindow(glfw3_h.java:4719)
Thanks to JornVernee. Problem solved. GLFW3 now works smoothly with JDK22 and Jextract. Sample code below.
1.Compile GLFW3 according to the official Jextract guide.
2.then run Java with "-I" flag to include .dll/.dylib should run smoothly.
import java.lang.foreign.*;
import org.glfw3.java.*;
class GLFW_Java {
public static void main(String[] args) {
System.loadLibrary("glfw3");
System.out.print("Start");
glfw3_h.glfwInit();
try (Arena arena = Arena.ofConfined()) {
String window_name_javaString = "Simple Example";
MemorySegment window_name_C = arena.allocateFrom(window_name_javaString);
MemorySegment window = (MemorySegment) glfw3_h.glfwCreateWindow(640, 480, window_name_C, MemorySegment.NULL, MemorySegment.NULL);
if (window != null) {
System.out.print(window);
}
glfw3_h.glfwMakeContextCurrent(window);
while (glfw3_h.glfwWindowShouldClose(window) == 0) {
glfw3_h.glfwSwapBuffers(window);
glfw3_h.glfwPollEvents();
}
glfw3_h.glfwDestroyWindow(window);
glfw3_h.glfwTerminate();
}
}
}