Tue Sep 07 17:30:54 2010: Request 53914 was acted upon. Transaction: Correspondence added by dbec...@roadrunner.com Queue: Win32-API Subject: Re: [rt.cpan.org #53914] Bug report for Win32::API::Callback Broken in: (no value) Severity: (no value) Owner: Nobody Requestors: perls...@mail.bg Status: open Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=53914 >
On 9/7/2010 4:51 AM, Aldo Calpini via RT wrote: > Tue Sep 07 07:51:32 2010: Request 53914 was acted upon. > Transaction: Correspondence added by ACALPINI > Queue: Win32-API > Subject: Bug report for Win32::API::Callback > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: perls...@mail.bg > Status: open > Ticket<URL: https://rt.cpan.org/Ticket/Display.html?id=53914> > > > my (wild enough) guess is that there is something different in the > PHANDLER_ROUTINE (the callback SetConsoleCtrlHandler expects) from other > working callbacks. Namely: > > BOOL WINAPI HandlerRoutine( > __in DWORD dwCtrlType > ); > > versus e.g.: > > BOOL CALLBACK EnumWindowsProc( > __in HWND hwnd, > __in LPARAM lParam > ); > > the difference is the WINAPI instead of CALLBACK definition. I think it > may have something to do with calling conventions and how parameters are > pushed to the stack. > > this would man that callbacks defined in C as WINAPI are not supported, > only those defined as CALLBACK are. > > but digging in the C headers to find the real difference between WINAPI > and CALLBACK, or even adding support for different calling conventions > in Win32::API::Callback is beyond my scope at the moment, sorry :-( They appear to be the esentially the same. Looks like it's just a matter of whether __stdcall calling convention is in use or not. WINDEF.H: #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) #define CALLBACK __stdcall #define WINAPI __stdcall #define WINAPIV __cdecl #define APIENTRY WINAPI #define APIPRIVATE __stdcall #define PASCAL __stdcall #else #define CALLBACK #define WINAPI #define WINAPIV #define APIENTRY WINAPI #define APIPRIVATE #define PASCAL pascal #endif