Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bindings #146

Closed
wants to merge 2 commits into from
Closed

Update bindings #146

wants to merge 2 commits into from

Conversation

hwsmm
Copy link
Collaborator

@hwsmm hwsmm commented Sep 21, 2024

Feel free to take over maintaining if I look inactive here!

Relevant osu!framework branch


This bindings update is currently a bit janky mostly because of this PR that changes SDL_bool to bool entirely.

Applied workarounds:

  • Add --language c in ClangSharp arguments because bool is C++ keyword, and re-define SDL_bool because C/C++ bool cannot be directly converted to C# bool.
  • Add != NULL / == NULL to compare pointers in header functions as ClangSharp generated pointer && pointer comparison, which is not possible in C#, after --language c.
  • Define NULL=0 as ClangSharp tried to put null in a variable of nint type after --language c.
  • Define some constant macros of SDL_pixels.h in manually written code, as adding --language c made SDL_Colorspace macros to have int for some reason.

I will probably report those bugs over ClangSharp repository since upgrading it didn't help...

@Susko3
Copy link
Member

Susko3 commented Sep 22, 2024

I don't like the complexity increase here. Most of the bool issues can be solved with --remap bool=SDL_bool. The only errors then are in ClangSharp generated function bodies that try to convert bool to enum SDL_bool, which doesn't work. Better to make SDL_bool a struct with implicit bool conversions.

So I've made #147 instead.

@hwsmm hwsmm closed this Sep 22, 2024
@hwsmm hwsmm deleted the update-sdl3 branch October 14, 2024 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants