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

casting function pointer to LPVOID* requires -fpermissive and is not standard C++ #69

Open
rkitover opened this issue Aug 10, 2018 · 1 comment

Comments

@rkitover
Copy link

For example, this thread:

https://bytes.com/topic/c/answers/584600-casting-function-pointers-void

Is there any way for the API to allow some kind of void(*funcPtr)() or something instead, that would be kosher in standard C++.

@m417z
Copy link
Collaborator

m417z commented Oct 5, 2021

FWIW, Microsoft uses LPVOID as well in its Detours hooking library:
https://github.com/microsoft/Detours/wiki/DetourAttach

Also, I suspect that for a hooking library such as MinHook or Detrours, using LPVOID for function pointers is not the least kosher thing w.r.t. standard C++, but it's probably kosher enough for the combination of a specific OS, architecture, and compiler(s), which can provide more guarantees.

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

No branches or pull requests

2 participants