neslib / Chet

C Header Translator for Delphi
BSD 2-Clause "Simplified" License
204 stars 43 forks source link

Justify the project with Godot headers #37

Open caryyu opened 1 month ago

caryyu commented 1 month ago

Recently, I'm thinking how to port Godot GDExtension headers into the Delphi world, so I found this project here, not sure how to start with and be afraid of the big compatible issues: https://github.com/godotengine/godot-cpp

Could the author here spend some time to make a Godot Bindings for Delphi to justify this project better? because I'm also a newbie to C++ and have a very limited knowledge about it, I think we could start from some small examples, thanks.

neslib commented 1 month ago

I have actually worked on this myself a couple of years ago. You actually don't need to convert the C++ headers (and Chet only supports C anyway). Instead, you only need to convert the gdextension_interface.h file (https://github.com/godotengine/godot-cpp/blob/master/gdextension/gdextension_interface.h).

The idea is that you use the generated API JSON file (https://github.com/godotengine/godot-cpp/blob/master/gdextension/extension_api.json) to create the Delphi classes. These Delphi classes will then use the converted gdextension_interface.h file to perform the work.

When I looked into this, it was still called GDNative, and they have changed the whole model for GDExtension. I haven't look at it since, in particular since there is no iOS support and I wanted to support all platforms.

Unfortunately, I don't have time to work on it now. It would require a lot of work, even to get something simple working. But the advantage is that because of the JSON file, maintenance should be relatively easy (sometimes even just a matter of rerunning the tool that converts the JSON file to Delphi code).