2015-12-15 23:48 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* config/dos/watcom.mk
  * config/win/watcom.mk
  * config/linux/watcom.mk
    ! enabled -bd OpenWatcom switch for code compiled as part of dynamic
      libraries
    * use CauseWay as default DOS extender for dynamic DOS builds

  * config/dyn.mk
  * config/lib.mk
  * src/Makefile
    ! fixed list of libraries used to create Harbour DLL in DOS builds

  * config/bin.mk
  * src/vm/Makefile
    * create hbmainstd library for OpenWatcom DOS shared builds

  * src/vm/maindllh.c
    + added DLL entry function for CauseWay DLLs in OpenWatcom builds

  * src/vm/main.c
    * include maindllh.c in OpenWatcom DOS shared builds

  * utils/hbmk2/hbmk2.prg
    + added support for dynamic binaries in DOS OpenWatcom builds.
      Support for CauseWay DLLs is still broken in current OpenWatcom
      builds so it will have to wait for the fix to be usable.

  * src/vm/dynlibhb.c
    + added support for dynamic libraries to OpenWatcom DOS builds.
      Now it's enabled only in harbour.dll due to problems with
      CW and current OW.

  * src/3rd/zlib/zconf.h
  * src/3rd/zlib/zlib.dif
    * use OS2 patch for exporting ZLIB symbols also in DOS builds

  * src/rdd/dbf1.c
    * pacified warning
This commit is contained in:
Przemysław Czerpak
2015-12-15 23:48:52 +01:00
parent e44ed3d3df
commit d074db1033
16 changed files with 169 additions and 52 deletions

View File

@@ -10,6 +10,46 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2015-12-15 23:48 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* config/dos/watcom.mk
* config/win/watcom.mk
* config/linux/watcom.mk
! enabled -bd OpenWatcom switch for code compiled as part of dynamic
libraries
* use CauseWay as default DOS extender for dynamic DOS builds
* config/dyn.mk
* config/lib.mk
* src/Makefile
! fixed list of libraries used to create Harbour DLL in DOS builds
* config/bin.mk
* src/vm/Makefile
* create hbmainstd library for OpenWatcom DOS shared builds
* src/vm/maindllh.c
+ added DLL entry function for CauseWay DLLs in OpenWatcom builds
* src/vm/main.c
* include maindllh.c in OpenWatcom DOS shared builds
* utils/hbmk2/hbmk2.prg
+ added support for dynamic binaries in DOS OpenWatcom builds.
Support for CauseWay DLLs is still broken in current OpenWatcom
builds so it will have to wait for the fix to be usable.
* src/vm/dynlibhb.c
+ added support for dynamic libraries to OpenWatcom DOS builds.
Now it's enabled only in harbour.dll due to problems with
CW and current OW.
* src/3rd/zlib/zconf.h
* src/3rd/zlib/zlib.dif
* use OS2 patch for exporting ZLIB symbols also in DOS builds
* src/rdd/dbf1.c
* pacified warning
2015-12-15 19:50 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/common/hbfopen.c
* use *fsopen() function instead of *fopen() in most of

View File

@@ -37,6 +37,10 @@ ifeq ($(BUILD_SHARED),yes)
else
HB_LIBS_TPL += hbmainstd
endif
else
ifeq ($(HB_PLATFORM)-$(HB_COMPILER),dos-watcom)
HB_LDFLAGS += FILE $(LIB_DIR)/hbmainstd.lib
endif
endif
endif
endif

View File

@@ -54,7 +54,11 @@ endif
# different SYS values: dos4g (default), pmodew (commercial), causeway,
# dos32a (DOS/32A LE executable), dos32x (DOS/32A LX executable)
LDFLAGS += SYS dos32a
ifeq ($(HB_BUILD_DYN),dostest)
LDFLAGS += SYS causeway
else
LDFLAGS += SYS dos32a
endif
LDLIBS := $(HB_USER_LIBS)
LDLIBS += $(foreach lib,$(LIBS),$(LIB_DIR)/$(lib))
@@ -73,12 +77,17 @@ endif
ifeq ($(HB_BUILD_DYN),dostest)
HB_DYN_COPT := -DHB_DYNLIB -bd
DY := $(LD)
DFLAGS += OP quiet SYS cwdllr
DY_OUT :=
DLIBS := $(foreach lib,$(HB_USER_LIBS),$(lib))
DLIBS += $(foreach lib,$(LIBS),$(LIB_DIR)/$(lib))
DLIBS += $(foreach lib,$(SYSLIBS),$(lib))
ifneq ($(HB_HAS_WATT),)
DLIBS += $(HB_LIB_WATT)/wattcpwf
endif
DLIBS := $(strip $(DLIBS))
ifneq ($(DLIBS),)

View File

@@ -52,6 +52,7 @@ HB_DYN_LIBS := \
gtgui \
gtwin \
gtos2 \
gtdos \
gttrm \
gtcrs \
gtsln \
@@ -65,17 +66,13 @@ endif
ifneq ($(HB_HAS_ZLIB_LOCAL),)
HB_DYN_LIBS += hbzlib
endif
ifeq ($(HB_PLATFORM),dos)
HB_DYN_LIBS += hbpmcom
endif
# hbcplr \
# hbdebug \
ifneq ($(HB_HAS_PCRE_LOCAL),)
HB_DYN_LIBS += hbpcre
endif
ifneq ($(HB_HAS_ZLIB_LOCAL),)
HB_DYN_LIBS += hbzlib
endif
DYN_FILE :=
IMP_FILE :=

View File

@@ -26,6 +26,7 @@ HB_DYN_LIBS := \
gtgui \
gtwin \
gtos2 \
gtdos \
gttrm \
gtcrs \
gtsln \
@@ -40,6 +41,9 @@ endif
ifneq ($(HB_HAS_ZLIB_LOCAL),)
HB_DYN_LIBS += hbzlib
endif
ifeq ($(HB_PLATFORM),dos)
HB_DYN_LIBS += hbpmcom
endif
# Added only for hbpp
-include $(TOP)$(ROOT)config/$(HB_PLATFORM)/libs.mk

View File

@@ -55,6 +55,8 @@ LDFLAGS += SYS linux
LDLIBS := $(HB_USER_LIBS)
LDLIBS += $(foreach lib,$(LIBS),$(LIB_DIR)/$(lib))
#HB_DYN_COPT := -DHB_DYNLIB -bd
#
#DY := $(LD)
#DFLAGS += OP quiet FORM elf dll LIBPATH $(WATCOM)/lib386 LIBPATH $(WATCOM)/lib386/linux OP exportall
#DY_OUT :=

View File

@@ -2,7 +2,7 @@ OBJ_EXT := .obj
LIB_PREF :=
LIB_EXT := .lib
HB_DYN_COPT := -DHB_DYNLIB
HB_DYN_COPT := -DHB_DYNLIB -bd
ifeq ($(HB_BUILD_MODE),cpp)
CC := wpp386

View File

@@ -361,7 +361,7 @@
# endif
#endif
#if defined(OS2) && defined(__WATCOMC__)
#if ( defined(__OS2__) || defined(__DOS__) ) && defined(__WATCOMC__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)

View File

@@ -127,7 +127,7 @@ diff -urN zlib.orig/zconf.h zlib/zconf.h
# endif
#endif
+
+#if defined(OS2) && defined(__WATCOMC__)
+#if ( defined(__OS2__) || defined(__DOS__) ) && defined(__WATCOMC__)
+# ifdef ZLIB_DLL
+# ifdef ZLIB_INTERNAL
+# define ZEXTERN extern __declspec(dllexport)

View File

@@ -37,6 +37,9 @@ else
ifeq ($(HB_PLATFORM),dos)
DYNDIRLIST_BASE += src/rtl/gtdos
ifneq ($(filter $(HB_COMPILER),watcom djgpp),)
DYNDIRLIST_BASE += src/3rd/hbpmcom
endif
endif
ifeq ($(HB_PLATFORM),os2)
DYNDIRLIST_BASE += src/rtl/gtos2

View File

@@ -6659,7 +6659,7 @@ static HB_ERRCODE hb_dbfRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ulC
hb_itemPutNI( pItem, pData->uiSetHeader );
if( ( iMode & ~0xFF ) == 0 )
pData->uiSetHeader = iMode;
pData->uiSetHeader = ( HB_USHORT ) iMode;
break;
}
case RDDI_DIRTYREAD:

View File

@@ -45,19 +45,22 @@ else
C_MAIN := mainstd.c
DIRS := mainstd maindllh maindllp
else
ifeq ($(HB_PLATFORM),wce)
C_MAIN := mainwin.c
DIRS := mainstd mainwin maindllh maindllp
else
ifeq ($(HB_PLATFORM),os2)
C_MAIN := mainstd.c
DIRS := mainstd maindllh
ifeq ($(HB_PLATFORM),wce)
C_MAIN := mainwin.c
DIRS := mainstd mainwin maindllh maindllp
else
C_MAIN := main.c
ifeq ($(HB_PLATFORM),os2)
C_MAIN := mainstd.c
DIRS := mainstd maindllh
else
ifeq ($(HB_PLATFORM)-$(HB_COMPILER),dos-watcom)
DIRS := mainstd
endif
C_MAIN := main.c
endif
endif
endif
endif
endif
ifeq ($(HB_HVM_ALL),yes)

View File

@@ -70,6 +70,13 @@
# endif
#elif defined( HB_OS_OS2 )
# include <os2.h>
#elif defined( HB_OS_DOS ) && defined( __WATCOMC__ ) && !defined( HB_CAUSEWAY_DLL )
/* it's broken in recent OpenWatcom builds so enable it
for tests only in harbur.dll [druzus] */
# if defined( HB_DYNLIB )
# define HB_CAUSEWAY_DLL
# include <cwdllfnc.h>
# endif
#endif
/* NOTE: VxWorks supports dlopen() functionality only in shared
@@ -143,6 +150,8 @@ PHB_ITEM hb_libLoad( PHB_ITEM pLibName, PHB_ITEM pArgs )
{
HB_TRACE( HB_TR_DEBUG, ( "hb_libLoad(): dlopen(): %s", dlerror() ) );
}
#elif defined( HB_CAUSEWAY_DLL )
hDynLib = LoadLibrary( hb_itemGetCPtr( pLibName ) );
#else
{
int iTODO;
@@ -187,6 +196,9 @@ HB_BOOL hb_libFree( PHB_ITEM pDynLib )
fResult = DosFreeModule( ( HMODULE ) hDynLib ) == NO_ERROR;
#elif defined( HB_HAS_DLFCN )
fResult = dlclose( hDynLib ) == 0;
#elif defined( HB_CAUSEWAY_DLL )
FreeLibrary( hDynLib );
fResult = HB_TRUE;
#endif
}
hb_vmUnlockModuleSymbols();
@@ -221,6 +233,8 @@ void * hb_libSymAddr( PHB_ITEM pDynLib, const char * pszSymbol )
return ( void * ) pProcAddr;
#elif defined( HB_HAS_DLFCN )
return dlsym( hDynLib, pszSymbol );
#elif defined( HB_CAUSEWAY_DLL )
return GetProcAddress( hDynLib, pszSymbol );
#else
HB_SYMBOL_UNUSED( pszSymbol );
#endif

View File

@@ -51,7 +51,9 @@
#include "hbsetup.h"
#if defined( HB_MAIN_STD )
#if defined( HB_DYNLIB ) && defined( __WATCOMC__ ) && defined( HB_OS_DOS )
#include "maindllh.c"
#elif defined( HB_MAIN_STD )
#include "mainstd.c"
#elif defined( HB_MAIN_WIN )
#include "mainwin.c"

View File

@@ -92,12 +92,45 @@ void hb_forceLinkMainStd( void ) {}
HB_EXTERN_END
#endif
#elif defined( HB_OS_OS2 )
#elif defined( HB_OS_OS2 ) && defined( __WATCOMC__ )
#if defined( __WATCOMC__ )
HB_EXTERN_BEGIN
void hb_forceLinkMainStd( void ) {}
HB_EXTERN_END
#elif defined( HB_OS_DOS ) && defined( __WATCOMC__ )
#if defined( _HB_CWDLL_DEBUG )
#include <cwdllfnc.h>
HB_EXTERN_BEGIN
extern char *_LpPgmName;
HB_EXTERN_END
int main( int iReason, char **dummy )
{
HB_SYMBOL_UNUSED( dummy );
if( iReason == 0 )
{
/* DLL initialization code */
printf( "DLL startup...\n" );
printf( "DLL File name: %s\n", GetModuleFileName( _psp ) );
printf( "Program name: %s\n", _LpPgmName );
}
else
{
/* DLL clean up code */
printf( "DLL shutdown...\n" );
}
return 0;
}
#else
int main( int iReason, char **dummy )
{
HB_SYMBOL_UNUSED( dummy );
HB_SYMBOL_UNUSED( iReason );
return 0;
}
#endif
#endif
#endif /* HB_OS_DOS && __WATCOMC__ */

View File

@@ -2394,30 +2394,6 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit
/* Process build-time configuration */
IF hbmk[ _HBMK_cPLAT ] == "dos"
SWITCH hbmk[ _HBMK_cCOMP ]
CASE "djgpp" ; tmp := "watt" ; cLibLibPrefix := "lib" ; cLibExt := ".a" ; EXIT
CASE "watcom" ; tmp := "wattcpwf" ; cLibLibPrefix := "" ; cLibExt := ".lib" ; EXIT
OTHERWISE ; tmp := NIL
ENDSWITCH
AAdd( hbmk[ _HBMK_aLIBUSERSYS ], "hbpmcom" )
IF ! Empty( tmp )
#if defined( HB_HAS_WATT )
AAdd( hbmk[ _HBMK_aLIBUSERSYSPRE ], tmp )
IF hb_DirExists( tmp1 := hb_DirSepToOS( GetEnv( "WATT_ROOT" ) ) + hb_ps() + "lib" )
AAdd( hbmk[ _HBMK_aLIBPATH ], tmp1 )
ENDIF
#else
IF hb_DirExists( tmp1 := hb_DirSepToOS( GetEnv( "WATT_ROOT" ) ) + hb_ps() + "lib" ) .AND. ;
hb_FileExists( tmp1 + hb_ps() + cLibLibPrefix + tmp + cLibExt )
AAdd( hbmk[ _HBMK_aLIBPATH ], tmp1 )
AAdd( hbmk[ _HBMK_aLIBUSERSYSPRE ], tmp )
ENDIF
#endif
ENDIF
ENDIF
/* Process automatic make files in current dir. */
IF hbmk[ _HBMK_lAutoHBM ] .AND. hb_FileExists( _HBMK_AUTOHBM_NAME )
IF ! hbmk[ _HBMK_lQuiet ]
@@ -3657,6 +3633,30 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit
ENDCASE
NEXT
IF hbmk[ _HBMK_cPLAT ] == "dos" .AND. ! hbmk[ _HBMK_lSHARED ]
SWITCH hbmk[ _HBMK_cCOMP ]
CASE "djgpp" ; tmp := "watt" ; cLibLibPrefix := "lib" ; cLibExt := ".a" ; EXIT
CASE "watcom" ; tmp := "wattcpwf" ; cLibLibPrefix := "" ; cLibExt := ".lib" ; EXIT
OTHERWISE ; tmp := NIL
ENDSWITCH
AAdd( hbmk[ _HBMK_aLIBUSERSYS ], "hbpmcom" )
IF ! Empty( tmp )
#if defined( HB_HAS_WATT )
AAdd( hbmk[ _HBMK_aLIBUSERSYSPRE ], tmp )
IF hb_DirExists( tmp1 := hb_DirSepToOS( GetEnv( "WATT_ROOT" ) ) + hb_ps() + "lib" )
AAdd( hbmk[ _HBMK_aLIBPATH ], tmp1 )
ENDIF
#else
IF hb_DirExists( tmp1 := hb_DirSepToOS( GetEnv( "WATT_ROOT" ) ) + hb_ps() + "lib" ) .AND. ;
hb_FileExists( tmp1 + hb_ps() + cLibLibPrefix + tmp + cLibExt )
AAdd( hbmk[ _HBMK_aLIBPATH ], tmp1 )
AAdd( hbmk[ _HBMK_aLIBUSERSYSPRE ], tmp )
ENDIF
#endif
ENDIF
ENDIF
IF hbmk[ _HBMK_lDEBUGPARS ]
FOR EACH aParam IN aParams
_hbmk_OutStd( hbmk, hb_StrFormat( "debugpars: %1$3d %2$s", aParam:__enumIndex(), ParamToString( aParam ) ) )
@@ -4788,14 +4788,16 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit
cBin_Link := "wlink" + hbmk[ _HBMK_cCCEXT ]
DO CASE
CASE hbmk[ _HBMK_cPLAT ] == "linux" ; cOpt_Link := "OP quiet SYS linux {FL} NAME {OE} {LO} {DL} {LL} {LB} {LF}{SCRIPT}"
CASE hbmk[ _HBMK_cPLAT ] == "dos" ; cOpt_Link := "OP quiet SYS dos32a {FL} NAME {OE} {LO} {DL} {LL} {LB} {LF}{SCRIPT}"
CASE hbmk[ _HBMK_cPLAT ] == "dos" ; cOpt_Link := iif( hbmk[ _HBMK_lSHARED ], ;
"OP quiet,map,stub=cwstub.exe SYS causeway {FL} {IM} NAME {OE} {LO} {DL} {LL} {LB} {LF} {LS}{SCRIPT}", ;
"OP quiet SYS dos32a {FL} NAME {OE} {LO} {DL} {LL} {LB} {LF}{SCRIPT}" )
CASE hbmk[ _HBMK_cPLAT ] == "win" ; cOpt_Link := "OP quiet {FL} {IM} NAME {OE} {LO} {DL} {LL} {LB} {LF} {LS}{SCRIPT}"
CASE hbmk[ _HBMK_cPLAT ] == "os2" ; cOpt_Link := "OP quiet SYS os2v2 {FL} {IM} NAME {OE} {LO} {DL} {LL} {LB} {LF} {LS}{SCRIPT}"
ENDCASE
cBin_Dyn := cBin_Link
cDynObjPrefix := cObjPrefix
DO CASE
CASE hbmk[ _HBMK_cPLAT ] == "dos" ; cBin_Dyn := NIL
CASE hbmk[ _HBMK_cPLAT ] == "dos" ; cOpt_Dyn := "OP quiet SYS cwdllr OP map,stub=cwstub.exe {FD} {IM} NAME {OD} {LO} {DL} {LL} {LB} {LF} {LS}{SCRIPT}"
CASE hbmk[ _HBMK_cPLAT ] == "linux" ; cOpt_Dyn := "OP quiet FORM elf dll OP exportall {FD} NAME {OD} {LO} {DL} {LL} {LB} {LF}{SCRIPT}"
IF hbmk[ _HBMK_lCreateDyn ]
AAdd( hbmk[ _HBMK_aLIBPATH ], hb_DirSepToOS( GetEnv( "WATCOM") + hb_ps() + "lib386" ) )
@@ -4822,7 +4824,7 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit
/* register callconv (-6r, -5r) puts an underscore after names */
cLibHBX_Regex := R_( "[\s]_?HB_FUN_([A-Z0-9_]*)_[\s]" )
ENDIF
IF HBMK_ISPLAT( "win|os2" )
IF HBMK_ISPLAT( "win|os2|dos" )
bBlk_ImpLib := {| cSourceDLL, cTargetLib, cFlags | win_implib_command_watcom( hbmk, cBin_Lib + " -q -o={OL} {ID}", cSourceDLL, cTargetLib, cFlags ) }
ENDIF
cLibLibExt := cLibExt
@@ -4886,6 +4888,10 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit
/* TOFIX: This line is plain guessing. */
AAdd( hbmk[ _HBMK_aOPTL ], "FILE " + hb_FNameExtSet( hbmk[ _HBMK_cHB_INSTALL_LIB ] + hb_ps() + iif( hbmk[ _HBMK_lGUI ], "hbmainstd", "hbmainstd" ), cLibExt ) )
ENDIF
CASE hbmk[ _HBMK_cPLAT ] == "dos"
l_aLIBSYS := ArrayAJoin( { l_aLIBSYS, l_aLIBSYSCORE, l_aLIBSYSMISC } )
l_aLIBSHARED := { cHarbourDyn + cLibExt }
AAdd( hbmk[ _HBMK_aOPTL ], "FILE " + hb_FNameExtSet( hbmk[ _HBMK_cHB_INSTALL_LIB ] + hb_ps() + "hbmainstd", cLibExt ) )
CASE hbmk[ _HBMK_cPLAT ] == "linux"
l_aLIBSYS := ArrayAJoin( { l_aLIBSYS, l_aLIBSYSCORE, l_aLIBSYSMISC } )
l_aLIBSHARED := { hbmk[ _HBMK_cDynLibPrefix ] + cHarbourDyn + cDL_Version + hbmk[ _HBMK_cDynLibExt ] }