2010-02-16 23:36 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/rtl/gtwvt/gtwvt.c
* contrib/gtwvg/gtwvg.c
! Fixed missing Windows constant on some compilers (older mingw I suppose),
after deleting _WIN32_WINNT override.
* contrib/xpp/Makefile
+ contrib/xpp/dll.ch
+ Added Xbase++ compatibility header.
* contrib/xpp/dllx.c
+ Described Xbase++ differences. (major ones)
! Changed DLLLOAD()/DLLUNLOAD() to use core loader functions,
instead of win-specific ones.
+ Made calling convention value Xbase++ compatible.
* contrib/hbwin/hbdyn.ch
+ Added Pascal calling convention. Not yet implemented.
This commit is contained in:
@@ -17,6 +17,25 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2010-02-16 23:36 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* src/rtl/gtwvt/gtwvt.c
|
||||
* contrib/gtwvg/gtwvg.c
|
||||
! Fixed missing Windows constant on some compilers (older mingw I suppose),
|
||||
after deleting _WIN32_WINNT override.
|
||||
|
||||
* contrib/xpp/Makefile
|
||||
+ contrib/xpp/dll.ch
|
||||
+ Added Xbase++ compatibility header.
|
||||
|
||||
* contrib/xpp/dllx.c
|
||||
+ Described Xbase++ differences. (major ones)
|
||||
! Changed DLLLOAD()/DLLUNLOAD() to use core loader functions,
|
||||
instead of win-specific ones.
|
||||
+ Made calling convention value Xbase++ compatible.
|
||||
|
||||
* contrib/hbwin/hbdyn.ch
|
||||
+ Added Pascal calling convention. Not yet implemented.
|
||||
|
||||
2010-02-16 21:04 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/xpp/Makefile
|
||||
- contrib/xpp/win_dllx.c
|
||||
|
||||
@@ -88,6 +88,10 @@
|
||||
#define WS_EX_LAYERED 0x00080000
|
||||
#endif
|
||||
|
||||
#ifndef LWA_ALPHA
|
||||
#define LWA_ALPHA 0x00000002
|
||||
#endif
|
||||
|
||||
#ifndef SM_REMOTESESSION
|
||||
#define SM_REMOTESESSION 0x1000
|
||||
#endif
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
/* C calling conventions */
|
||||
#define HB_DYN_CALLCONV_STDCALL 0x000000 /* Windows API default */
|
||||
#define HB_DYN_CALLCONV_CDECL 0x100000 /* C default */
|
||||
#define HB_DYN_CALLCONV_PASCAL 0x200000 /* OS/2 default. Not yet supported. */
|
||||
|
||||
/* String encodings */
|
||||
#define HB_DYN_ENC_ASCII 0x000000
|
||||
|
||||
@@ -35,6 +35,7 @@ PRG_SOURCES := \
|
||||
typefilx.prg \
|
||||
|
||||
PRG_HEADERS := \
|
||||
dll.ch \
|
||||
xpp.ch \
|
||||
|
||||
ifneq ($(filter $(HB_PLATFORM),win wce),)
|
||||
|
||||
74
harbour/contrib/xpp/dll.ch
Normal file
74
harbour/contrib/xpp/dll.ch
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Xbase++ compatibility header
|
||||
*
|
||||
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
/* NOTE: This file is also used by C code. */
|
||||
|
||||
#ifndef _DLL_CH
|
||||
#define _DLL_CH
|
||||
|
||||
#define DLL_CDECL 0x08
|
||||
#define DLL_STDCALL 0x20
|
||||
#define DLL_SYSTEM 0x04
|
||||
#if defined( __PLATFORM__WINDOWS )
|
||||
#define DLL_OSAPI DLL_STDCALL
|
||||
#elif defined( __PLATFORM__OS2 )
|
||||
#define DLL_OSAPI DLL_SYSTEM
|
||||
#else
|
||||
#define DLL_OSAPI DLL_CDECL
|
||||
#endif
|
||||
|
||||
/* Only for compatiblity.
|
||||
Harbour always copies the string to a temporary buffer. */
|
||||
#define DLL_CALLMODE_COPY 0
|
||||
#define DLL_CALLMODE_NORMAL DLL_CALLMODE_COPY
|
||||
|
||||
#endif /* _DLL_CH */
|
||||
@@ -61,6 +61,8 @@
|
||||
#include "hbwin.h"
|
||||
#include "hbdyn.h"
|
||||
|
||||
#include "dll.ch"
|
||||
|
||||
/* NOTE: I'm not totally familiar with how Xbase++ works. This functionality
|
||||
was derived from the context in which the functions are used. [pt] */
|
||||
|
||||
@@ -97,25 +99,25 @@ static const HB_GC_FUNCS s_gcDllFuncs =
|
||||
_DLLMark
|
||||
};
|
||||
|
||||
/* NOTE: In Harbour this function will return an in-memory object, not a string. */
|
||||
/* NOTE: 2nd and 3rd parameters are not supported in Harbour. */
|
||||
|
||||
HB_FUNC_EXTERN( HB_LIBLOAD );
|
||||
|
||||
HB_FUNC( DLLLOAD )
|
||||
{
|
||||
void * hFileName;
|
||||
|
||||
hb_retnint( ( HB_PTRDIFF ) LoadLibrary( HB_PARSTRDEF( 1, &hFileName, NULL ) ) );
|
||||
|
||||
hb_strfree( hFileName );
|
||||
HB_FUNC_EXEC( HB_LIBLOAD );
|
||||
}
|
||||
|
||||
HB_FUNC_EXTERN( HB_LIBFREE );
|
||||
|
||||
HB_FUNC( DLLUNLOAD )
|
||||
{
|
||||
if( HB_ISPOINTER( 1 ) )
|
||||
hb_retl( FreeLibrary( ( HMODULE ) hb_parptr( 1 ) ) ? HB_TRUE : HB_FALSE );
|
||||
else if( HB_ISNUM( 1 ) )
|
||||
hb_retl( FreeLibrary( ( HMODULE ) ( HB_PTRDIFF ) hb_parnint( 1 ) ) ? HB_TRUE : HB_FALSE );
|
||||
else
|
||||
hb_retl( HB_FALSE );
|
||||
HB_FUNC_EXEC( HB_LIBFREE );
|
||||
}
|
||||
|
||||
/* NOTE: Function ordinals are not supported in 3rd parameter. */
|
||||
|
||||
HB_FUNC( DLLCALL )
|
||||
{
|
||||
PHB_ITEM pLibrary = hb_param( 1, HB_IT_ANY );
|
||||
@@ -133,9 +135,18 @@ HB_FUNC( DLLCALL )
|
||||
|
||||
if( pLibraryHandle )
|
||||
{
|
||||
int iXPPFlags = hb_parni( 2 );
|
||||
int iFuncFlags = 0;
|
||||
void * pFunctionPtr = hb_libSymAddr( pLibraryHandle, hb_parcx( 3 ) );
|
||||
|
||||
hb_dynCall( HB_ISNUM( 2 ) ? hb_parni( 2 ) : HB_DYN_CALLCONV_STDCALL,
|
||||
if( ( iXPPFlags & DLL_CDECL ) != 0 )
|
||||
iFuncFlags |= HB_DYN_CALLCONV_CDECL;
|
||||
if( ( iXPPFlags & DLL_STDCALL ) != 0 )
|
||||
iFuncFlags |= HB_DYN_CALLCONV_STDCALL;
|
||||
if( ( iXPPFlags & DLL_SYSTEM ) != 0 )
|
||||
iFuncFlags |= HB_DYN_CALLCONV_PASCAL;
|
||||
|
||||
hb_dynCall( iFuncFlags,
|
||||
pFunctionPtr,
|
||||
hb_pcount(),
|
||||
4,
|
||||
@@ -146,6 +157,9 @@ HB_FUNC( DLLCALL )
|
||||
}
|
||||
}
|
||||
|
||||
/* NOTE: Function ordinals are not supported in 3rd parameter. */
|
||||
/* NOTE: In Harbour this function will return an in-memory object, not a string. */
|
||||
|
||||
HB_FUNC( DLLPREPARECALL )
|
||||
{
|
||||
PHB_DLLEXEC xec = ( PHB_DLLEXEC ) hb_gcAllocate( sizeof( HB_DLLEXEC ), &s_gcDllFuncs );
|
||||
@@ -174,7 +188,14 @@ HB_FUNC( DLLPREPARECALL )
|
||||
xec->pFunctionPtr = hb_libSymAddr( xec->pLibraryHandle, hb_parcx( 3 ) );
|
||||
if( xec->pFunctionPtr )
|
||||
{
|
||||
xec->iFuncFlags = HB_ISNUM( 2 ) ? hb_parni( 2 ) : HB_DYN_CALLCONV_STDCALL;
|
||||
int iXPPFlags = hb_parni( 2 );
|
||||
|
||||
if( ( iXPPFlags & DLL_CDECL ) != 0 )
|
||||
xec->iFuncFlags |= HB_DYN_CALLCONV_CDECL;
|
||||
if( ( iXPPFlags & DLL_STDCALL ) != 0 )
|
||||
xec->iFuncFlags |= HB_DYN_CALLCONV_STDCALL;
|
||||
if( ( iXPPFlags & DLL_SYSTEM ) != 0 )
|
||||
xec->iFuncFlags |= HB_DYN_CALLCONV_PASCAL;
|
||||
|
||||
hb_retptrGC( xec );
|
||||
return;
|
||||
|
||||
@@ -88,6 +88,10 @@
|
||||
#define WS_EX_LAYERED 0x00080000
|
||||
#endif
|
||||
|
||||
#ifndef LWA_ALPHA
|
||||
#define LWA_ALPHA 0x00000002
|
||||
#endif
|
||||
|
||||
#ifndef SM_REMOTESESSION
|
||||
#define SM_REMOTESESSION 0x1000
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user