Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6345941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:55:14+00:00 2026-05-24T20:55:14+00:00

Here is output: g++ -DDEBUG -DUNITTEST -IC:/Users/Steven/Dropbox/Programming/entropy_p5_makefile/cpp/game/../include/ -O0 -g3 -Wall -c -fmessage-length=0 -o Input.o

  • 0

Here is output:

g++ -DDEBUG -DUNITTEST -IC:/Users/Steven/Dropbox/Programming/entropy_p5_makefile/cpp/game/../include/ -O0 -g3 -Wall -c -fmessage-length=0 -o Input.o ..\Input.cpp
..\Input.cpp: In function 'void mousehookCustomRoutine(E_thread*, void*)':
..\Input.cpp:78:93: error: invalid conversion from 'LRESULT (*)(int, WPARAM, LPARAM)' to 'LRESULT (*)(int, WPARAM, LPARAM)'
..\Input.cpp:78:93: error:   initializing argument 2 of 'void* SetWindowsHookExA(int, LRESULT (*)(int, WPARAM, LPARAM), HINSTANCE__*, DWORD)'
Build error occurred, build is stopped

This is the code:

LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam) {
    //...
}

void mousehookCustomRoutine(E_thread *me, void *arg = (void *)&MouseHookProc) {
    // arg is the ptr to LL Mouse Routine

    me->sendMessage(0x14,me,(void*)GetCurrentThreadId());
    // send message to self in order for my parent to know how to identify me via threadID
    HHOOK mousehook = SetWindowsHookEx(WH_MOUSE_LL, (LRESULT (*)(int,WPARAM,LPARAM))arg,NULL, 0); // I am line 78
    if (mousehook == NULL) printf("Mousehook error %lu\n",GetLastError());
    //...
}

It makes no sense because I am casting to the exact type that it expects to receive, there aren’t any qualifiers or anything that are different. What could possibly be going on here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:55:15+00:00Added an answer on May 24, 2026 at 8:55 pm

    First, don’t cast function pointers to void *. It is never safe to invoke a function of one type after casting it to another, and so there’s rarely, if ever, a need to make them void *.

    Second, probably you’re seeing a difference in calling conventions. The type of the hook parameter is, properly stated, (LRESULT (CALLBACK *) (int, WPARAM, LPARAM)), or simply HOOKPROC. The prototype of the function should look like LRESULT CALLBACK MouseHookProc(int, WPARAM, LPARAM). Most likely gcc doesn’t pretty-print the calling-convention specifier, but does check for it when checking type equivalence. Subtle problems like this are another reason not to cast function pointers – had you used a (HOOKPROC) cast, you would have had no compile-time error, but could have crashed at runtime …. but only on certain versions of windows.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is a simple program to output to a text file: #include <iostream> #include
I'm using codeblocks. I'm using ubuntu. Here is output of compilation. g++ -Wall -O2
So here's the output of inspect on a class: <Recurly::BillingInfo::CreditCard:0x1036a8a98 @prefix_options={}, @attributes={month=>1, last_four=>1, type=>bogus,
Alright, here is the output I get: arm-none-linux-gnueabi-ld --entry=main -dynamic-linker=/system/bin/linker -rpath-link=/home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib -L/home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib -nostdlib -lstdc++
Here is some dprofpp -I output, for almost the same program on different input
Here is the complete install command to CPAN and the output: sudo perl -MCPAN
Here's a puzzler: can anyone explain why cd fails when the output is redirected
I was reading about output buffering in JavaScript here , and was trying to
Here is my string $newPath = '/~new/assets/js/../packages/prettyphoto/js/jquery.prettyPhoto.js'; Now check this output var_dump($newPath); // string(64)
I've posted the same question here a few days ago( Java reading standard output

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.