Re: [Mingw-users] How to use GetProceAddress in Mingw ?
- Date: Tue, 13 Nov 2007 09:46:58 -0800
- From: Brian Dessent <brian@xxxxxxxxxxx>
- Subject: Re: [Mingw-users] How to use GetProceAddress in Mingw ?
James Yu wrote:
> typedef int (__cdecl *MYPROC)(LPWSTR);
This is very wrong. Win32 API functions are type WINAPI (i.e. stdcall)
not cdecl. It is quite likely that you will crash or otherwise suffer
very strange behavior due to a broken stack if you try to call a
function through a pointer declared with the wrong calling convention.
> if (SendInput = (MYPROC)GetProcAddress(hModule,
> "SendInput")) {
> puts("SendInput is not found.");
> }
This does not make sense, as the body of the 'if' is executed when the
return value is nonzero, as would be the case when it succeeds.
Brian
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users