Replies: 5 comments
-
The code you're showing is clearly Objective-C code. This won't work. And the problem likely is that it was picked for processing in the first place. Unfortunately, your question doesn't show what command caused the problem. My approach for dealing with macOS frameworks can be seen at https://github.com/manuelbl/JavaDoesUSB/tree/main/java-does-usb/jextract/macos. Translated to the GLUT framework, it looks like this (for JDK 19 / jextract 19): Don't include the framework header file directly. Instead create a helper file using the #include statement with angular brackets: opengl_helper.h
Clang (jextract) will correctly resolve such include statements if the compile_flags.txt
Then call jextract like so:
This will generate 266 files. The file
and then replaced with:
|
Beta Was this translation helpful? Give feedback.
-
Thank you a lot for taking time to answer with details. I have been able to generate the binding for GLUT that I made available here if you are interested. I had a slightly different approach to deal with other macOS SDK. I first define links toward all folder that I want to include :
So that I can later refer to a single include folder that Clang properly handle. Then if I want AppKit I do this
I tried to generate bindings to AppKit.h with the hope to have Java bindings allowing to do something similar to OSXmisc.m in JOGL - which starts by including AppKit. However the function I want to reproduce with Panama has non C/C++ code inside, so this might not work from Panama :( Maybe I'll have to keep this in pure JNI and mainly bind to GL/GLU/GLUT/CGL with Panama. Thanks for having cleanly documented your project, that was really instructive for me! |
Beta Was this translation helpful? Give feedback.
-
Ah, so you were trying to use the AppKit framework. It seems that the majority of frameworks are Objective-C frameworks. They cannot be used from C and thus not from Panama either. I don't have a list of C vs Objective-C frameworks. But if grep finds matches for |
Beta Was this translation helpful? Give feedback.
-
Thank you a lot, your answer help a lot on bumping my project to JDK19 :) |
Beta Was this translation helpful? Give feedback.
-
For your information : I also add to delete
|
Beta Was this translation helpful? Give feedback.
-
@manuelbl I have been advised to explore your work to go further with JExtract/Panama that I use to generate Java bindings to OpenGL.
You seam to be experienced at generating bindings to macOS SDK frameworks so I'd like to ask how you deal with surprising cases such as in
Foundation/NSObjCRuntime.h
at line 492. The @Class keyword does not seam to be regular C language to me.Here is JExtract output:
./panama-gl-bindings-macos/include/Foundation/NSObjCRuntime.h:492:1: error: expected identifier or '('
How did you deal with this kind of line?
Beta Was this translation helpful? Give feedback.
All reactions