diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5004192872..8e59fa59ba 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,22 @@ The license applies to all entries newer than 2009-04-28. */ +2010-11-05 00:58 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * config/cygwin/gcc.mk + * include/hbwmain.c + * src/vm/Makefile + * src/vm/mainwin.c + * src/vm/hvm.c + * src/vm/cmdarg.c + * src/vm/mainstd.c + * utils/hbmk2/hbmk2.prg + + Finalizing cygwin/gcc entry point. + ; Patch by Tamas. + + Added hbmainstd for shared cygwin/gcc builds. + + * utils/hbrun/hbrun.hbp + + Enabled header inclusion also in hbmk2 make file. + 2010-11-04 22:44 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/hbjson.c * src/rtl/hblpp.c diff --git a/harbour/config/cygwin/gcc.mk b/harbour/config/cygwin/gcc.mk index 37e3c1b607..cecc7efa23 100644 --- a/harbour/config/cygwin/gcc.mk +++ b/harbour/config/cygwin/gcc.mk @@ -51,6 +51,13 @@ LD_OUT := -o LIBPATHS := -L$(LIB_DIR) LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),-l$(lib)) +# Add the standard C entry +ifneq ($(HB_LINKING_RTL),) + ifeq ($(HB_MAIN),) + LDLIBS += -lhbmainstd + endif +endif + LDFLAGS += $(LIBPATHS) AR := $(HB_CCPATH)$(HB_CCPREFIX)ar diff --git a/harbour/include/hbwmain.c b/harbour/include/hbwmain.c index 38b1cdb390..1db0c0ac93 100644 --- a/harbour/include/hbwmain.c +++ b/harbour/include/hbwmain.c @@ -63,7 +63,7 @@ static char * s_argv[ HB_MAX_ARGS ]; # define HB_LPSTR LPSTR #endif -#if defined( HB_VM_STARTUP ) && !defined( HB_OS_CYGWIN ) +#if defined( HB_VM_STARTUP ) extern void hb_winmainArgInit( HANDLE hInstance, HANDLE hPrevInstance, int iCmdShow ); /* Set WinMain() parameters */ #endif @@ -131,15 +131,7 @@ int WINAPI WinMain( HINSTANCE hInstance, /* handle to current instance */ #endif #if defined( HB_VM_STARTUP ) - - #if !defined( HB_OS_CYGWIN ) - hb_winmainArgInit( hInstance, hPrevInstance, iCmdShow ); - #else - HB_SYMBOL_UNUSED( hInstance ); - HB_SYMBOL_UNUSED( hPrevInstance ); - HB_SYMBOL_UNUSED( iCmdShow ); - #endif - + hb_winmainArgInit( hInstance, hPrevInstance, iCmdShow ); hb_cmdargInit( s_argc, s_argv ); hb_vmInit( HB_TRUE ); diff --git a/harbour/src/vm/Makefile b/harbour/src/vm/Makefile index 4c00e16b01..f1859ad3ef 100644 --- a/harbour/src/vm/Makefile +++ b/harbour/src/vm/Makefile @@ -46,22 +46,22 @@ ifeq ($(HB_PLATFORM),win) DIRS := mainstd mainwin maindllh maindllp else ifeq ($(HB_PLATFORM),cygwin) + 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),wce) - C_MAIN := mainwin.c - DIRS := mainstd mainwin maindllh maindllp + ifeq ($(HB_PLATFORM),os2) + C_MAIN := mainstd.c + DIRS := mainstd maindllh else - ifeq ($(HB_PLATFORM),os2) - C_MAIN := mainstd.c - DIRS := mainstd maindllh - else - C_MAIN := main.c - endif + C_MAIN := main.c endif endif endif +endif ifeq ($(HB_HVM_ALL),yes) diff --git a/harbour/src/vm/cmdarg.c b/harbour/src/vm/cmdarg.c index c95d3a70a7..f59708ebb9 100644 --- a/harbour/src/vm/cmdarg.c +++ b/harbour/src/vm/cmdarg.c @@ -68,28 +68,18 @@ #include #endif -#if defined( HB_OS_CYGWIN ) - #include -#endif - -#if defined( HB_OS_WIN ) || defined( HB_OS_CYGWIN ) - #include -#endif - /* Command line argument management */ static int s_argc = 0; static char ** s_argv = NULL; #if !defined( HB_OS_WIN ) - static char s_szAppName[ HB_PATH_MAX ]; - - #if defined( HB_OS_CYGWIN ) - static char s_lpAppName[ MAX_PATH ]; - #endif +static char s_szAppName[ HB_PATH_MAX ]; #else +#include + static char s_szAppName[ MAX_PATH ]; static TCHAR s_lpAppName[ MAX_PATH ]; @@ -157,30 +147,16 @@ void hb_cmdargUpdate( void ) if( s_argc > 0 ) { -#if defined( HB_OS_WIN ) || defined( HB_OS_CYGWIN ) +#if defined( HB_OS_WIN ) + /* NOTE: Manually setup the executable name in Windows, because in console apps the name may be truncated in some cases, and in GUI apps it's not filled at all. [vszakats] */ if( GetModuleFileName( NULL, s_lpAppName, HB_SIZEOFARRAY( s_lpAppName ) ) != 0 ) { - #if defined( HB_OS_WIN ) - HB_TCHAR_COPYFROM( s_szAppName, s_lpAppName, HB_SIZEOFARRAY( s_szAppName ) - 1 ); - s_argv[ 0 ] = s_szAppName; - - #else /* HB_OS_CYGWIN */ - - ssize_t pathlen; - - pathlen = cygwin_conv_path( CCP_WIN_A_TO_POSIX|CCP_ABSOLUTE, s_lpAppName, NULL, 0 ); - if( pathlen > 0 && - pathlen <= HB_SIZEOFARRAY( s_szAppName ) && - cygwin_conv_path( CCP_WIN_A_TO_POSIX|CCP_ABSOLUTE, s_lpAppName, s_szAppName, - HB_SIZEOFARRAY( s_szAppName ) ) != -1 ) - s_argv[ 0 ] = s_szAppName; - #endif } #elif defined( HB_OS_OS2 ) diff --git a/harbour/src/vm/hvm.c b/harbour/src/vm/hvm.c index d66833b4c7..f93598d676 100644 --- a/harbour/src/vm/hvm.c +++ b/harbour/src/vm/hvm.c @@ -11915,9 +11915,8 @@ HB_LANG_REQUEST( HB_LANG_DEFAULT ) #undef HB_FORCE_LINK_MAIN -#if ( !defined( HB_DYNLIB ) && defined( HB_OS_WIN ) && \ - ( defined( __DMC__ ) || defined( __WATCOMC__ ) || defined( __MINGW32__ ) ) ) || \ - defined( HB_OS_CYGWIN ) +#if !defined( HB_DYNLIB ) && defined( HB_OS_WIN ) && \ + ( defined( __DMC__ ) || defined( __WATCOMC__ ) || defined( __MINGW32__ ) ) # define HB_FORCE_LINK_MAIN hb_forceLinkMainWin diff --git a/harbour/src/vm/mainwin.c b/harbour/src/vm/mainwin.c index 0d4c83d46e..dc34b84556 100644 --- a/harbour/src/vm/mainwin.c +++ b/harbour/src/vm/mainwin.c @@ -55,13 +55,12 @@ #if !( defined( HB_DYNLIB ) && defined( __WATCOMC__ ) ) -#if defined( HB_OS_WIN ) || defined( HB_OS_CYGWIN ) +#if defined( HB_OS_WIN ) #define HB_VM_STARTUP #include "hbwmain.c" -#if ( !defined( HB_DYNLIB ) && ( defined( __DMC__ ) || defined( __WATCOMC__ ) || defined( __MINGW32__ ) ) ) || \ - defined( HB_OS_CYGWIN ) +#if !defined( HB_DYNLIB ) && ( defined( __DMC__ ) || defined( __WATCOMC__ ) || defined( __MINGW32__ ) ) HB_EXTERN_BEGIN void hb_forceLinkMainWin( void ) {} HB_EXTERN_END diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 73c7217d05..9fd2347484 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -3337,6 +3337,10 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel ) AAddNew( hbmk[ _HBMK_aLIBPATH ], "/usr/local/lib" ) ENDIF + IF hbmk[ _HBMK_cPLAT ] == "cygwin" + l_aLIBSHAREDPOST := { "hbmainstd" } + ENDIF + CASE ( hbmk[ _HBMK_cPLAT ] == "win" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; ( hbmk[ _HBMK_cPLAT ] == "win" .AND. hbmk[ _HBMK_cCOMP ] == "mingw" ) .OR. ; ( hbmk[ _HBMK_cPLAT ] == "win" .AND. hbmk[ _HBMK_cCOMP ] == "mingw64" ) .OR. ; diff --git a/harbour/utils/hbrun/hbrun.hbp b/harbour/utils/hbrun/hbrun.hbp index b1b1c33f33..505c8ad126 100644 --- a/harbour/utils/hbrun/hbrun.hbp +++ b/harbour/utils/hbrun/hbrun.hbp @@ -4,6 +4,8 @@ -q0 -w3 -es2 -kmo -l +-DHBRUN_WITH_HEADERS + -ldflag={allmsvc}-nxcompat -ldflag={allmsvc}-dynamicbase -ldflag={allmsvc}-fixed:no