2008-05-30 02:48 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbvm.h
  * harbour/source/vm/hvm.c
  * harbour/source/vm/extrap.c
    * moved code to set exception handler from hvm.c to extrap.c
    + added void hb_vmSetExceptionHandler( void ) to set exception
      filter
    ! fixed problem with C++ builds caused by missing extern "C"
      declaration for exception handlers in extrap.c
This commit is contained in:
Przemyslaw Czerpak
2008-05-30 00:48:06 +00:00
parent 10a36db3fa
commit 5472511ddc
4 changed files with 37 additions and 37 deletions

View File

@@ -8,6 +8,16 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-05-30 02:48 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbvm.h
* harbour/source/vm/hvm.c
* harbour/source/vm/extrap.c
* moved code to set exception handler from hvm.c to extrap.c
+ added void hb_vmSetExceptionHandler( void ) to set exception
filter
! fixed problem with C++ builds caused by missing extern "C"
declaration for exception handlers in extrap.c
2008-05-30 01:54 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* contrib/make_b32_all.bat
* contrib/make_vc_all.bat

View File

@@ -99,6 +99,8 @@ extern HB_EXPORT PHB_SYMB hb_vmProcessSymbolsEx( PHB_SYMB pSymbols, USHORT uiSym
extern void hb_vmEnumRelease( PHB_ITEM pBase, PHB_ITEM pValue );
#endif
extern void hb_vmSetExceptionHandler( void );
extern HB_EXPORT void hb_vmSymbolInit_RT( void ); /* initialization of runtime support symbols */
/* Harbour virtual machine escaping API */

View File

@@ -53,6 +53,7 @@
#define HB_OS_WIN_32_USED
#include "hbapi.h"
#include "hbvm.h"
#include "hbapifs.h"
#include "hbdate.h"
@@ -145,3 +146,26 @@ ULONG _System hb_os2ExceptionHandler( PEXCEPTIONREPORTRECORD p1,
}
#endif
void hb_vmSetExceptionHandler( void )
{
#if defined(HB_OS_WIN_32)
{
LPTOP_LEVEL_EXCEPTION_FILTER ef = SetUnhandledExceptionFilter( hb_win32ExceptionHandler );
HB_SYMBOL_UNUSED( ef );
}
#elif defined(HB_OS_OS2) /* Add OS2TermHandler to this thread's chain of exception handlers */
{
EXCEPTIONREGISTRATIONRECORD RegRec; /* Exception Registration Record */
APIRET rc; /* Return code */
memset( &RegRec, 0, sizeof( RegRec ) );
RegRec.ExceptionHandler = ( ERR ) hb_os2ExceptionHandler;
rc = DosSetExceptionHandler( &RegRec );
if( rc != NO_ERROR )
{
hb_errInternal( HB_EI_ERRUNRECOV, "Unable to setup exception handler (DosSetExceptionHandler())", NULL, NULL );
}
}
#endif
}

View File

@@ -66,8 +66,6 @@
*
*/
#define HB_OS_WIN_32_USED /* for exception handler */
#include <math.h>
#include <time.h>
@@ -96,22 +94,6 @@
#include "hbpp.h"
#endif
HB_EXTERN_BEGIN
#if defined(HB_OS_WIN_32)
LONG WINAPI hb_win32ExceptionHandler( struct _EXCEPTION_POINTERS * ExceptionInfo );
#elif defined(HB_OS_OS2)
/* 21/10/00 - maurilio.longo@libero.it
This Exception Handler gets called in case of an abnormal termination of an harbour program and
displays a full stack trace at the harbour language level */
extern ULONG _System hb_os2ExceptionHandler(PEXCEPTIONREPORTRECORD p1,
PEXCEPTIONREGISTRATIONRECORD p2,
PCONTEXTRECORD p3,
PVOID pv);
#endif
HB_EXTERN_END
/* DEBUG only*/
/* #include <windows.h> */
@@ -488,25 +470,7 @@ HB_EXPORT void hb_vmInit( BOOL bStartMainProc )
#endif
}
#if defined(HB_OS_WIN_32)
{
LPTOP_LEVEL_EXCEPTION_FILTER ef = SetUnhandledExceptionFilter( hb_win32ExceptionHandler );
HB_SYMBOL_UNUSED( ef );
}
#elif defined(HB_OS_OS2) /* Add OS2TermHandler to this thread's chain of exception handlers */
{
EXCEPTIONREGISTRATIONRECORD RegRec; /* Exception Registration Record */
APIRET rc; /* Return code */
memset( &RegRec, 0, sizeof( RegRec ) );
RegRec.ExceptionHandler = ( ERR ) hb_os2ExceptionHandler;
rc = DosSetExceptionHandler( &RegRec );
if( rc != NO_ERROR )
{
hb_errInternal( HB_EI_ERRUNRECOV, "Unable to setup exception handler (DosSetExceptionHandler())", NULL, NULL );
}
}
#endif
hb_vmSetExceptionHandler();
if( bStartMainProc && s_pSymStart )
{