From f847912e0d3cac7e526badf2ae75993dd0b4f2e8 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 28 May 2010 16:51:23 +0000 Subject: [PATCH] 2010-05-28 18:51 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbmisc/calldll.prg ! Fixed to use Windows system .dll calling convention (stdcall) by default, to emulate original function's behavior. Note that on non-Windows systems, calling convention will be set to the default (cdecl). * contrib/hbmisc/tests/testcall.prg * Replace examples with a Windows system .dll call. --- harbour/ChangeLog | 10 ++++++++++ harbour/contrib/hbmisc/calldll.prg | 9 ++++++++- harbour/contrib/hbmisc/tests/testcall.prg | 13 ++++--------- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ca66cf75dc..f8d4b536bc 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,16 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-05-28 18:51 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbmisc/calldll.prg + ! Fixed to use Windows system .dll calling convention + (stdcall) by default, to emulate original function's + behavior. Note that on non-Windows systems, calling + convention will be set to the default (cdecl). + + * contrib/hbmisc/tests/testcall.prg + * Replace examples with a Windows system .dll call. + 2010-05-28 18:28 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg + Added untested, experimental support for -reqpkg=/reqpkgs= diff --git a/harbour/contrib/hbmisc/calldll.prg b/harbour/contrib/hbmisc/calldll.prg index 3aa733a4be..3ce2b1c93c 100644 --- a/harbour/contrib/hbmisc/calldll.prg +++ b/harbour/contrib/hbmisc/calldll.prg @@ -63,7 +63,14 @@ PROCEDURE UNLOADALLDLL() FUNCTION CALLDLL32( cFunction, cLibrary, ... ) RETURN HB_DYNACALL1( cFunction, cLibrary, NIL, ... ) -#define _DEF_CALLCONV_ HB_DYN_CTYPE_CHAR_PTR +#if define( __PLATFORM__WINDOWS ) + /* Use Windows system .dll calling convention on Windows systems, + like in original lib. Original .lib was a Windows-only solution. + [vszakats] */ + #define _DEF_CALLCONV_ HB_DYN_CALLCONV_STDCALL +#else + #define _DEF_CALLCONV_ HB_DYN_CALLCONV_CDECL +#endif FUNCTION HB_DYNACALL1( cFunction, cLibrary, nCount, ... ) LOCAL aParams diff --git a/harbour/contrib/hbmisc/tests/testcall.prg b/harbour/contrib/hbmisc/tests/testcall.prg index 08665d0d33..e5b38ffcda 100644 --- a/harbour/contrib/hbmisc/tests/testcall.prg +++ b/harbour/contrib/hbmisc/tests/testcall.prg @@ -11,15 +11,10 @@ */ PROCEDURE Main() + LOCAL nFlags - ? CALLDLL32( "curl_version", "libcurl.dll" ) - - ? CALLDLL32( "SSLeay_version", "libeay32.dll", 0 ) - ? CALLDLL32( "SSLeay_version", "libeay32.dll", 1 ) - ? CALLDLL32( "SSLeay_version", "libeay32.dll", 2 ) - ? CALLDLL32( "SSLeay_version", "libeay32.dll", 3 ) - ? CALLDLL32( "SSLeay_version", "libeay32.dll", 4 ) - - ? HB_DYNACALL1( "SSLeay_version", "libeay32.dll", 0, 4 ) + nFlags := -1 + ? CALLDLL32( "InternetGetConnectedState", "wininet.dll", @nFlags, 0 ) + ? nFlags RETURN