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

function signature mistake #3

Closed
vkensou opened this issue Nov 24, 2024 · 3 comments
Closed

function signature mistake #3

vkensou opened this issue Nov 24, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@vkensou
Copy link
Contributor

vkensou commented Nov 24, 2024

In SDL_video.h, SDL_GetWindowPosition and SDL_GetWindowSize do not have a return value.

extern fn SDL_GetWindowPosition(window: *Window, x: ?*i32, y: ?*i32) i32;

extern fn SDL_GetWindowSize(window: *Window, w: ?*i32, h: ?*i32) i32;

@hazeycode
Copy link
Member

These functions write to the pointers that are passed in if non-null. This reflects the underlying API.

The arguments should perhaps be renamed to out_w and out_h to help make this more obvious to the reader. Furthermore doc comments should be added to describe the API.

@hazeycode hazeycode added the documentation Improvements or additions to documentation label Nov 25, 2024
@vkensou
Copy link
Contributor Author

vkensou commented Nov 26, 2024

These functions write to the pointers that are passed in if non-null. This reflects the underlying API.

The arguments should perhaps be renamed to out_w and out_h to help make this more obvious to the reader. Furthermore doc comments should be added to describe the API.

I mean, is the prebuilt SDL2.so/dll provided by gamedev modified? These two functions in SDL2 have no return value.
I am a bit confused. It seems the prebuilt SDL2.dll provided is actually SDL3.

@hazeycode
Copy link
Member

hazeycode commented Nov 26, 2024

Sorry, misunderstood the OP. You are correct, we are incorrectly defining the SDL procs as returning ints (as if they return an error code) but these should be void functions.

SDL3 does return values for these fns if there was an error. We probably mistakenly brought that change into our SDL2 bindings at some point.

@hazeycode hazeycode added bug Something isn't working and removed documentation Improvements or additions to documentation labels Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants