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

fix(dynamiclib): invalid function pointer to data pointer conversion #24

Merged
merged 1 commit into from
Aug 11, 2023

Conversation

takase1121
Copy link
Contributor

When compiling ltreesitter on Windows with all the warnings enabled (based on the Makefile), the line with GetProcAddress throws an error. This is because it actually returns a FARPROC (a function pointer type) and the function returns a void pointer (a data pointer type), and such conversion are illegal in ISO C. POSIX implicitly guarantees this.

This PR instead use double casting to return a void pointer. This isn't beautiful, but it tricks the compiler to thinking that it's valid ISO C.

@euclidianAce euclidianAce merged commit 0c63020 into euclidianAce:main Aug 11, 2023
5 checks passed
@euclidianAce
Copy link
Owner

Thanks!

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