2010-05-27 20:23 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbmisc/calldll.prg
+ HB_DYNCALL1() will now cut the number of parameters
according to passed nCount parameter, just to mimic
exact behavior of original function.
+ contrib/hbmisc/tests/testcall.prg
+ Added test code for CALLDLL32() and HB_DYNCALL1().
* contrib/hbwin/tests/testcopy.prg
* Copyright year.
This commit is contained in:
@@ -17,6 +17,18 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2010-05-27 20:23 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbmisc/calldll.prg
|
||||
+ HB_DYNCALL1() will now cut the number of parameters
|
||||
according to passed nCount parameter, just to mimic
|
||||
exact behavior of original function.
|
||||
|
||||
+ contrib/hbmisc/tests/testcall.prg
|
||||
+ Added test code for CALLDLL32() and HB_DYNCALL1().
|
||||
|
||||
* contrib/hbwin/tests/testcopy.prg
|
||||
* Copyright year.
|
||||
|
||||
2010-05-27 19:57 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbmisc/Makefile
|
||||
+ contrib/hbmisc/calldll.prg
|
||||
|
||||
@@ -63,9 +63,10 @@ PROCEDURE UNLOADALLDLL()
|
||||
FUNCTION CALLDLL32( cFunction, cLibrary, ... )
|
||||
RETURN HB_DYNACALL1( cFunction, cLibrary, NIL, ... )
|
||||
|
||||
FUNCTION HB_DYNACALL1( cFunction, cLibrary, nCount, ... )
|
||||
#define _DEF_CALLCONV_ HB_DYN_CTYPE_CHAR_PTR
|
||||
|
||||
HB_SYMBOL_UNUSED( nCount )
|
||||
FUNCTION HB_DYNACALL1( cFunction, cLibrary, nCount, ... )
|
||||
LOCAL aParams
|
||||
|
||||
IF ISCHARACTER( cFunction ) .AND. ;
|
||||
ISCHARACTER( cLibrary )
|
||||
@@ -74,7 +75,16 @@ FUNCTION HB_DYNACALL1( cFunction, cLibrary, nCount, ... )
|
||||
s_hDLL[ cLibrary ] := hb_LibLoad( cLibrary )
|
||||
ENDIF
|
||||
|
||||
RETURN hb_dynCall( { cFunction, s_hDLL[ cLibrary ], HB_DYN_CTYPE_CHAR_PTR }, ... )
|
||||
IF ISNUMBER( nCount )
|
||||
IF nCount == 0
|
||||
RETURN hb_dynCall( { cFunction, s_hDLL[ cLibrary ], _DEF_CALLCONV_ } )
|
||||
ELSEIF nCount >= 0 .AND. nCount < PCount() - 3
|
||||
aParams := ASize( hb_AParams(), nCount )
|
||||
RETURN hb_dynCall( { cFunction, s_hDLL[ cLibrary ], _DEF_CALLCONV_ }, hb_arrayToParams( aParams ) )
|
||||
ENDIF
|
||||
ELSE
|
||||
RETURN hb_dynCall( { cFunction, s_hDLL[ cLibrary ], _DEF_CALLCONV_ }, ... )
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN NIL
|
||||
|
||||
25
harbour/contrib/hbmisc/tests/testcall.prg
Normal file
25
harbour/contrib/hbmisc/tests/testcall.prg
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
*
|
||||
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
*/
|
||||
|
||||
PROCEDURE Main()
|
||||
|
||||
? 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 )
|
||||
|
||||
RETURN
|
||||
@@ -5,7 +5,7 @@
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
*
|
||||
* Copyright 2009 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user