diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1b5ef64afd..3b8f676e61 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,10 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-09-15 17:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/contrib/hbwin/win_com.c + * initialize s_PortData structure at application startup + 2009-09-15 17:11 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hbnetio/netiocli.c ! added missing in previous commit casting for C++ mode diff --git a/harbour/contrib/hbwin/win_com.c b/harbour/contrib/hbwin/win_com.c index 24a59bbfa9..475423f98e 100644 --- a/harbour/contrib/hbwin/win_com.c +++ b/harbour/contrib/hbwin/win_com.c @@ -63,15 +63,12 @@ static struct DWORD dwError; } s_PortData[ 256 ]; -#if 0 -HB_INITFUNC( WIN_COMINIT ) +static void hb_wincom_init( void ) { int i; - for( i = 0; i < ( int ) HB_SIZEOFARRAY( s_PortData ); i++ ) s_PortData[ i ].hPort = INVALID_HANDLE_VALUE; } -#endif HB_FUNC( WIN_COMOPEN ) { @@ -842,3 +839,18 @@ HB_FUNC( WIN_COMDEBUGDCB ) else hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } + +HB_CALL_ON_STARTUP_BEGIN( _hb_wincom_init_ ) + hb_wincom_init(); +HB_CALL_ON_STARTUP_END( _hb_wincom_init_ ) + +#if defined( HB_PRAGMA_STARTUP ) + #pragma startup _hb_wincom_init_ +#elif defined( HB_MSC_STARTUP ) + #if defined( HB_OS_WIN_64 ) + #pragma section( HB_MSC_START_SEGMENT, long, read ) + #endif + #pragma data_seg( HB_MSC_START_SEGMENT ) + static HB_$INITSYM hb_vm_auto_wincom_init = _hb_wincom_init_; + #pragma data_seg() +#endif