2009-12-21 08:21 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbgtcore.h
  * harbour/include/hbapigt.h
    * moved declaration of hb_gtSetDefault() from hbgtcore.h to hbapigt.h

  * harbour/include/hbapi.h
  * harbour/src/vm/hvm.c
    + added new function hb_vmSetDefaultGT()

  * harbour/bin/hb-func.sh
  * harbour/utils/hbmk2/hbmk2.prg
    * use hb_vmSetDefaultGT() to set default GT
    * removed extern declarations for functions defined in hbapi.h

  * harbour/src/vm/dynlibhb.c
    + added support for HB_LIBLOAD()/HB_LIBFREE() in DJGPP 2.04 builds

  * harbour/config/global.mk
    * use 8.3 names for harbour dynamic libraries in all DOS builds

  * harbour/config/dos/djgpp.mk
    + added support for dynamic libraries (DXE) in DJGPP builds.
      DXE is sth similar to DLL in Windows and can be used with
      DJGPP 2.04. I had to make some modifications in DXE header
      files to make it working so it will not work in default DJGPP
      installation. I'll document these modifications in the future.

  * harbour/config/dos/watcom.mk
    * enable creating of harbour dynamic libraries only when HB_BUILD_DLL
      is explictly set by user to 'yes'. In DOS DJGPP and OpenWatcom builds
      DLLs support is not functional yet.

  * harbour/config/dyn.mk
    * added an option to create harbour dynamic libraries from static
      ones instead of .o|.obj files. It's necessary for DXE3GEN which
      internally calls LD which has some limited on maximum size of passed
      parameters.
      TODO: make HB_DYN_LIBS definition common for dyn.mk and lib.mk
This commit is contained in:
Przemyslaw Czerpak
2009-12-21 07:22:14 +00:00
parent 8f0476314e
commit bdfb6a9e93
12 changed files with 167 additions and 74 deletions

View File

@@ -17,6 +17,45 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-12-21 08:21 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbgtcore.h
* harbour/include/hbapigt.h
* moved declaration of hb_gtSetDefault() from hbgtcore.h to hbapigt.h
* harbour/include/hbapi.h
* harbour/src/vm/hvm.c
+ added new function hb_vmSetDefaultGT()
* harbour/bin/hb-func.sh
* harbour/utils/hbmk2/hbmk2.prg
* use hb_vmSetDefaultGT() to set default GT
* removed extern declarations for functions defined in hbapi.h
* harbour/src/vm/dynlibhb.c
+ added support for HB_LIBLOAD()/HB_LIBFREE() in DJGPP 2.04 builds
* harbour/config/global.mk
* use 8.3 names for harbour dynamic libraries in all DOS builds
* harbour/config/dos/djgpp.mk
+ added support for dynamic libraries (DXE) in DJGPP builds.
DXE is sth similar to DLL in Windows and can be used with
DJGPP 2.04. I had to make some modifications in DXE header
files to make it working so it will not work in default DJGPP
installation. I'll document these modifications in the future.
* harbour/config/dos/watcom.mk
* enable creating of harbour dynamic libraries only when HB_BUILD_DLL
is explictly set by user to 'yes'. In DOS DJGPP and OpenWatcom builds
DLLs support is not functional yet.
* harbour/config/dyn.mk
* added an option to create harbour dynamic libraries from static
ones instead of .o|.obj files. It's necessary for DXE3GEN which
internally calls LD which has some limited on maximum size of passed
parameters.
TODO: make HB_DYN_LIBS definition common for dyn.mk and lib.mk
2009-12-21 02:49 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/hbqt.ch
* contrib/hbxbp/xbp.ch

View File

@@ -736,13 +736,9 @@ hb_lnk_request()
gt="\${HB_GT_REQ%% *}"
if [ -n "\$gt" ] || [ -n "\${HB_MAIN_FUNC}" ]; then
echo "#include \\"hbinit.h\\""
echo "HB_EXTERN_BEGIN"
echo "extern \${HB_LNK_ATTR} const char * hb_gt_szNameDefault;"
echo "extern \${HB_LNK_ATTR} void hb_vmSetLinkedMain( const char * szMain );"
echo "HB_EXTERN_END"
echo "HB_CALL_ON_STARTUP_BEGIN( hb_lnk_SetDefault_build )"
if [ -n "\$gt" ]; then
echo " hb_gt_szNameDefault = \\"\$gt\\";"
echo " hb_vmSetDefaultGT( \\"\$gt\\" );"
fi
if [ -n "\${HB_MAIN_FUNC}" ]; then
if [ \${HB_MAIN_FUNC} != \${HB_MAIN_FUNC/x/y} ]; then

View File

@@ -11,6 +11,7 @@ endif
OBJ_EXT := .o
LIB_PREF := lib
LIB_EXT := .a
DYN_EXT := .dxe
CC := $(HB_CCPATH)$(HB_CCPREFIX)$(HB_CMP)$(HB_CCPOSTFIX)
CC_IN := -c
@@ -38,6 +39,9 @@ endif
ifneq ($(filter $(HB_BUILD_STRIP),all bin),)
LDSTRIP := -s
DYSTRIP := -s
else
LDSTRIP :=
DYSTRIP :=
endif
SYSLIBPATHS :=
@@ -100,22 +104,34 @@ AR_RULE = $(create_library)
LD_RULE = $(link_exe_file)
#DY := $(CC)
#DFLAGS += -Wl,-shared $(LIBPATHS)
#DY_OUT := -o$(subst x,x, )
#DLIBS := $(foreach lib,$(HB_USER_LIBS) $(SYSLIBS),-l$(lib))
#
## NOTE: The empty line directly before 'endef' HAVE TO exist!
#define dyn_object
# @$(ECHO) $(ECHOQUOTE)INPUT($(subst \,/,$(file)))$(ECHOQUOTE) >> __dyn__.tmp
#
#endef
#define create_dynlib
# $(if $(wildcard __dyn__.tmp),@$(RM) __dyn__.tmp,)
# $(foreach file,$^,$(dyn_object))
# $(DY) $(DFLAGS) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ __dyn__.tmp $(DLIBS) $(DYSTRIP)
#endef
#
#DY_RULE = $(create_dynlib)
ifeq ($(HB_BUILD_DLL),yes)
DY := dxe3gen
DFLAGS += $(LIBPATHS)
DY_OUT := -o$(subst x,x, )
DLIBS := $(foreach lib,$(HB_USER_LIBS) $(SYSLIBS),-l$(lib))
# due to limited size of ld parameter list use libraries directly
HB_DYN_FROM_LIBS := yes
DFLAGS += --whole-archive
DLIBS :=
# NOTE: The empty line directly before 'endef' HAVE TO exist!
define dyn_object
@$(ECHO) $(ECHOQUOTE)$(subst \,/,$(file))$(ECHOQUOTE) >> __dyn__.tmp
endef
define create_dynlib
@$(ECHO) $(ECHOQUOTE)$(DFLAGS) $(HB_USER_DFLAGS)$(ECHOQUOTE) > __dyn__.tmp
@$(ECHO) $(ECHOQUOTE)$(DY_OUT)$(DYN_DIR)/$@$(ECHOQUOTE) >> __dyn__.tmp
@$(ECHO) $(ECHOQUOTE)-Y $(IMP_FILE) -U $(DYSTRIP)$(ECHOQUOTE) >> __dyn__.tmp
$(foreach file,$^,$(dyn_object))
@$(ECHO) $(ECHOQUOTE)$(DLIBS)$(ECHOQUOTE) >> __dyn__.tmp
$(DY) @__dyn__.tmp
endef
DY_RULE = $(create_dynlib)
endif # HB_BUILD_DLL
include $(TOP)$(ROOT)config/rules.mk

View File

@@ -7,6 +7,7 @@
OBJ_EXT := .obj
LIB_PREF :=
LIB_EXT := .lib
DYN_EXT := .dll
ifeq ($(HB_BUILD_MODE),cpp)
CC := wpp386
@@ -70,32 +71,36 @@ ifneq ($(HB_LINKING_RTL),)
endif
endif
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))
DLIBS := $(strip $(DLIBS))
ifeq ($(HB_BUILD_DLL),yes)
ifneq ($(DLIBS),)
comma := ,
DLIBS_COMMA := LIB $(subst $(subst x,x, ),$(comma) ,$(DLIBS))
else
DLIBS_COMMA :=
endif
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))
DLIBS := $(strip $(DLIBS))
# NOTE: The empty line directly before 'endef' HAVE TO exist!
define dyn_object
@$(ECHO) $(ECHOQUOTE)FILE '$(file)'$(ECHOQUOTE) >> __dyn__.tmp
ifneq ($(DLIBS),)
comma := ,
DLIBS_COMMA := LIB $(subst $(subst x,x, ),$(comma) ,$(DLIBS))
else
DLIBS_COMMA :=
endif
endef
define create_dynlib
$(if $(wildcard __dyn__.tmp),@$(RM) __dyn__.tmp,)
$(foreach file,$^,$(dyn_object))
$(DY) $(DFLAGS) $(HB_USER_DFLAGS) NAME '$(subst /,$(DIRSEP),$(DYN_DIR)/$@)' OP implib='$(IMP_FILE)' @__dyn__.tmp $(DLIBS_COMMA)
endef
# NOTE: The empty line directly before 'endef' HAVE TO exist!
define dyn_object
@$(ECHO) $(ECHOQUOTE)FILE '$(file)'$(ECHOQUOTE) >> __dyn__.tmp
DY_RULE = $(create_dynlib)
endef
define create_dynlib
$(if $(wildcard __dyn__.tmp),@$(RM) __dyn__.tmp,)
$(foreach file,$^,$(dyn_object))
$(DY) $(DFLAGS) $(HB_USER_DFLAGS) NAME '$(subst /,$(DIRSEP),$(DYN_DIR)/$@)' OP implib='$(IMP_FILE)' @__dyn__.tmp $(DLIBS_COMMA)
endef
DY_RULE = $(create_dynlib)
endif # HB_BUILD_DLL
include $(TOP)$(ROOT)config/common/watcom.mk

View File

@@ -19,33 +19,63 @@ endif
-include $(TOP)$(ROOT)config/$(HB_PLATFORM)/libs.mk
# We're linking them directly to Harbour dynlib now.
#ifneq ($(HB_HAS_PCRE_LOCAL),)
# SYSLIBS += hbpcre
#endif
#ifneq ($(HB_HAS_ZLIB_LOCAL),)
# SYSLIBS += hbzlib
#endif
include $(TOP)$(ROOT)config/$(HB_PLATFORM)/$(HB_COMPILER).mk
include $(TOP)$(ROOT)config/c.mk
include $(TOP)$(ROOT)config/prg.mk
HB_LIBS_TPL = \
hbextern \
hbdebug \
$(_HB_VM) \
ifeq ($(HB_LINKING_VMMT),yes)
_HB_VM := hbvmmt
else
_HB_VM := hbvm
endif
HB_DYN_LIBS := \
hbcommon \
hbpp \
hbrtl \
hbmacro \
hblang \
hbcpage \
$(HB_GT_LIBS) \
$(_HB_RDD) \
hbrtl \
hbextern \
hbrdd \
rddntx \
rddnsx \
rddcdx \
rddfpt \
hbsix \
hbhsx \
hbusrrdd \
gtcgi \
gtpca \
gtstd \
gtwvt \
gtgui \
gtwin \
gtos2 \
gttrm \
gtcrs \
gtsln \
gtxwc \
$(_HB_VM) \
hbmacro \
hbcplr \
hbpp \
hbcommon
hbmaindllh
ifneq ($(HB_HAS_PCRE_LOCAL),)
HB_DYN_LIBS += hbpcre
endif
ifneq ($(HB_HAS_ZLIB_LOCAL),)
HB_DYN_LIBS += hbzlib
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 :=
@@ -63,7 +93,11 @@ ifneq ($(IMP_DIR),)
IMP_FILE := $(IMP_DIR)/$(IMP_NAME)
endif
ALL_OBJS := $(subst /,$(DIRSEP),$(foreach dir,$(DYNDIRLIST),$(wildcard $(TOP)$(ROOT)$(dir)/$(OBJ_DIR)/*$(OBJ_DYN_POSTFIX)$(OBJ_EXT))))
ifeq ($(HB_DYN_FROM_LIBS),yes)
ALL_OBJS := $(subst /,$(DIRSEP),$(foreach lib,$(HB_DYN_LIBS),$(wildcard $(LIB_DIR)/$(LIB_PREF)$(lib)$(LIB_EXT))))
else
ALL_OBJS := $(subst /,$(DIRSEP),$(foreach dir,$(DYNDIRLIST),$(wildcard $(TOP)$(ROOT)$(dir)/$(OBJ_DIR)/*$(OBJ_DYN_POSTFIX)$(OBJ_EXT))))
endif
first:: dirbase descend

View File

@@ -1354,7 +1354,7 @@ ifeq ($(HB_INIT_DONE),)
endif
endif
ifeq ($(HB_PLATFORM)-$(HB_COMPILER),dos-watcom)
ifeq ($(HB_PLATFORM),dos)
HB_DYNLIB_BASE_ST := harbour
HB_DYNLIB_BASE_MT := harbourm
HB_DYNLIB_ST := $(HB_DYNLIB_BASE_ST)

View File

@@ -1123,6 +1123,7 @@ extern void * hb_i18n_alloc( void * cargo );
#endif /* _HB_API_INTERNAL_ || _HB_I18N_INTERNAL_ */
extern HB_EXPORT void hb_vmSetLinkedMain( const char * szMain );
extern HB_EXPORT void hb_vmSetDefaultGT( const char * szGtName );
/* misc */
extern HB_EXPORT const char * hb_verCPU( void ); /* retrieves a constant string with CPU architecture */

View File

@@ -156,6 +156,7 @@ typedef struct
extern void hb_gtIsGtRef( void * );
extern HB_EXPORT void hb_gtStartupInit( void );
extern HB_EXPORT void hb_gtSetDefault( const char * szGtName );
extern HB_EXPORT void * hb_gtAlloc( void * hGT );
extern HB_EXPORT void hb_gtRelease( void * hGT );
extern HB_EXPORT void hb_gtAttach( void * hGT );

View File

@@ -590,7 +590,6 @@ extern void hb_gt_gcMark( void );
#define HB_GTSUPER_GFXTEXT(g,t,l,s,c,h,w) (HB_GTSUPERTABLE(g))->GfxText(g,t,l,s,c,h,w)
#define HB_GTSUPER_WHOCARES(g,p) (HB_GTSUPERTABLE(g))->WhoCares(g,p)
extern HB_EXPORT void hb_gtSetDefault( const char * szGtName );
extern HB_EXPORT BOOL hb_gtRegister( const HB_GT_INIT * gtInit );
extern HB_EXPORT PHB_GT hb_gtLoad( const char * szGtName, PHB_GT pGT, PHB_GT_FUNCS pSuperTable );

View File

@@ -68,7 +68,9 @@
#if !defined( HB_HAS_DLFCN ) && \
( ( defined( HB_OS_LINUX ) && !defined( __WATCOMC__ ) ) || \
defined( HB_OS_SUNOS ) || defined( HB_OS_DARWIN ) || \
defined( HB_OS_BSD ) || defined( HB_OS_BEOS ) )
defined( HB_OS_BSD ) || defined( HB_OS_BEOS ) || \
( defined( __DJGPP__ ) && \
( __DJGPP__ > 2 || ( __DJGPP__ == 2 && __DJGPP_MINOR__ >= 4 ) ) ) )
# define HB_HAS_DLFCN
#endif

View File

@@ -11514,6 +11514,11 @@ void hb_vmSetLinkedMain( const char * szMain )
s_vm_pszLinkedMain = szMain;
}
void hb_vmSetDefaultGT( const char * szGtName )
{
hb_gtSetDefault( szGtName );
}
/* Force linking default language and codepage modules */
HB_CODEPAGE_REQUEST( HB_CODEPAGE_DEFAULT )
HB_LANG_REQUEST( HB_LANG_DEFAULT )

View File

@@ -3700,11 +3700,6 @@ FUNCTION hbmk( aArgs, /* @ */ lPause )
'HB_CALL_ON_STARTUP_BEGIN( _hb_hbmk_setdef_ )' + Chr( 10 )
ELSE
cFile += '#include "hbinit.h"' + Chr( 10 ) +;
'' + Chr( 10 ) +;
'HB_EXTERN_BEGIN' + Chr( 10 ) +;
'extern ' + tmp + ' void hb_vmSetLinkedMain( const char * szMain );' + Chr( 10 ) +;
'extern ' + tmp + ' void hb_gtSetDefault( const char * szGtName );' + Chr( 10 ) +;
'HB_EXTERN_END' + Chr( 10 ) +;
'' + Chr( 10 ) +;
'HB_CALL_ON_STARTUP_BEGIN( _hb_hbmk_setdef_ )' + Chr( 10 )
ENDIF
@@ -3713,7 +3708,7 @@ FUNCTION hbmk( aArgs, /* @ */ lPause )
hbmk[ _HBMK_nHBMODE ] == _HBMODE_XHB
cFile += ' s_defaultGT = "' + Upper( SubStr( hbmk[ _HBMK_cGT ], 3 ) ) + '";' + Chr( 10 )
ELSE
cFile += ' hb_gtSetDefault( "' + Upper( SubStr( hbmk[ _HBMK_cGT ], 3 ) ) + '" );' + Chr( 10 )
cFile += ' hb_vmSetDefaultGT( "' + Upper( SubStr( hbmk[ _HBMK_cGT ], 3 ) ) + '" );' + Chr( 10 )
ENDIF
ENDIF
IF l_cMAIN != NIL