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 build errors with clang-cl version 19 and newer #6

Open
wants to merge 1 commit into
base: clang-vs2022
Choose a base branch
from

Conversation

emruiz81
Copy link

@emruiz81 emruiz81 commented Feb 9, 2025

When upgrading visual studio 2022 to the latest update, clang-cl toolchain updates to versio 19 (from version 17). And a compilation error occurs refered to cast conversions on function pointers, something like this:

error : cast from 'FARPROC' (aka 'int (*)() attribute((stdcall))') to 'PFN_DECODEPOINTER' (aka 'void ()(void *) attribute((stdcall))') converts to incompatible function type [-Werror,-Wcast-function-type-mismatch]

This patch addresses this issue with a two step cast conversion that convinces the compiler.

@oliverportcnc
Copy link

It would probably be better to use std::memcpy to copy the pointer value as according to the standard function pointers and data pointers don't have to be the same size. Might prevent other warnings popping up in the future.

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