2009-03-26 16:05 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbole/olecore.c
* added two notes with default defines for windows header files
! small correction and fixes in casting
; Now this code can be compiled by MinGW and OpenWatcom if we uncomment
CINTERFACE setting. Anyhow I'd prefer to use C++ friendly declarations.
Mindaugas, this code uses static variable: s_lOleError.
Can we make it thread local? It should resolve the problem with using
this code in MT programs.
The next thing is the place where OLE is uninitialized.
It's done by hb_vmAtExit(). In some cases it may be problematic
because after hb_vmAtExit() some .prg destructors can be executed
yet, f.e. when public variables are destroyed. The HB_OLEAUTO()
objects uses destructor which can be activated after executing
hb_ole_exit(). To resolve this problem you can replicate the trick
with pointer variable stored inside static .prg var I added to old
OLE code in contrib/whbwin/ (.prg destructors are disabled just
before releasing static variables). It's not elegant solution
but it will work. Probably we should think about two levels of
exit procedures. The second one can be used only for pure C code
which does not try to reenter HVM.
* harbour/contrib/gtwvg/gtwvg.h
! moved _WIN32_IE declaration before #include ... to fix MinGW32
compilation
This commit is contained in:
@@ -8,6 +8,32 @@
|
||||
2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
|
||||
*/
|
||||
|
||||
2009-03-26 16:05 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/contrib/hbole/olecore.c
|
||||
* added two notes with default defines for windows header files
|
||||
! small correction and fixes in casting
|
||||
; Now this code can be compiled by MinGW and OpenWatcom if we uncomment
|
||||
CINTERFACE setting. Anyhow I'd prefer to use C++ friendly declarations.
|
||||
Mindaugas, this code uses static variable: s_lOleError.
|
||||
Can we make it thread local? It should resolve the problem with using
|
||||
this code in MT programs.
|
||||
The next thing is the place where OLE is uninitialized.
|
||||
It's done by hb_vmAtExit(). In some cases it may be problematic
|
||||
because after hb_vmAtExit() some .prg destructors can be executed
|
||||
yet, f.e. when public variables are destroyed. The HB_OLEAUTO()
|
||||
objects uses destructor which can be activated after executing
|
||||
hb_ole_exit(). To resolve this problem you can replicate the trick
|
||||
with pointer variable stored inside static .prg var I added to old
|
||||
OLE code in contrib/whbwin/ (.prg destructors are disabled just
|
||||
before releasing static variables). It's not elegant solution
|
||||
but it will work. Probably we should think about two levels of
|
||||
exit procedures. The second one can be used only for pure C code
|
||||
which does not try to reenter HVM.
|
||||
|
||||
* harbour/contrib/gtwvg/gtwvg.h
|
||||
! moved _WIN32_IE declaration before #include ... to fix MinGW32
|
||||
compilation
|
||||
|
||||
2009-03-26 15:54 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
|
||||
* utils/hbmk2/hbmk2.prg
|
||||
+ Added autodetection of embedded MinGW64 and MinGWCE
|
||||
|
||||
@@ -62,6 +62,11 @@
|
||||
#define CINTERFACE 1
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_IE
|
||||
#define _WIN32_IE 0x0400
|
||||
#endif
|
||||
|
||||
|
||||
/* #define NONAMELESSUNION */
|
||||
|
||||
//-------------------------------------------------------------------//
|
||||
@@ -93,10 +98,6 @@
|
||||
|
||||
#include "hbgtwvg.ch"
|
||||
|
||||
#ifndef _WIN32_IE
|
||||
#define _WIN32_IE 0x0400
|
||||
#endif
|
||||
|
||||
HB_EXTERN_BEGIN
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
@@ -51,6 +51,24 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* This option can resolve compilation problems in C++ mode for some
|
||||
* compilers like OpenWatcom but not for all, f.e. it will not help
|
||||
* BCC when used with -P (C++ mode) switch.
|
||||
*/
|
||||
/*
|
||||
#if defined( __cplusplus ) && !defined( CINTERFACE )
|
||||
#define CINTERFACE 1
|
||||
#endif
|
||||
*/
|
||||
|
||||
/* This code uses named union so this declaration is necessary for
|
||||
* compilers where nameless unions are default
|
||||
*/
|
||||
#if !defined( NONAMELESSUNION )
|
||||
#define NONAMELESSUNION
|
||||
#endif
|
||||
|
||||
#include "hbapi.h"
|
||||
#include "hbapiitm.h"
|
||||
#include "hbapicls.h"
|
||||
@@ -69,9 +87,9 @@ static PHB_DYNS s_pDyns_hObjAssign;
|
||||
static PHB_DYNS s_pDyns_GetMessage;
|
||||
|
||||
|
||||
void hb_oleInit( void ); /* TODO: move to some hbole.h */
|
||||
HB_EXPORT void hb_oleInit( void ); /* TODO: move to some hbole.h */
|
||||
|
||||
void HB_FUN_HB_OLEAUTO( void );
|
||||
HB_FUNC_EXTERN( HB_OLEAUTO );
|
||||
|
||||
|
||||
static void hb_olecore_init( void* cargo )
|
||||
@@ -204,10 +222,10 @@ static void hb_oleVariantToItem( PHB_ITEM pItem, VARIANT* pVariant )
|
||||
hb_vmPushDynSym( s_pDyns_hb_oleauto );
|
||||
hb_vmPushNil();
|
||||
hb_vmDo( 0 );
|
||||
|
||||
|
||||
pRet = hb_itemNew( NULL );
|
||||
hb_itemMove( pRet, hb_stackReturnItem() );
|
||||
|
||||
|
||||
hb_vmPushDynSym( s_pDyns_hObjAssign );
|
||||
hb_vmPush( pRet );
|
||||
hb_vmPushPointer( pVariant->n1.n2.n3.pdispVal );
|
||||
@@ -320,7 +338,7 @@ HB_FUNC( OLECREATEOBJECT ) /* ( cOleName | cCLSID [, cIID ] ) */
|
||||
GUID ClassID, iid;
|
||||
REFIID riid = &IID_IDispatch;
|
||||
IDispatch* pDisp = NULL;
|
||||
|
||||
BOOL fIID = FALSE;
|
||||
|
||||
cCLSID = AnsiToWide( hb_parc( 1 ) );
|
||||
if ( hb_parc( 1 )[ 0 ] == '{' )
|
||||
@@ -340,12 +358,12 @@ HB_FUNC( OLECREATEOBJECT ) /* ( cOleName | cCLSID [, cIID ] ) */
|
||||
else
|
||||
memcpy( (LPVOID) &iid, hb_parc( 2 ), sizeof( iid ) );
|
||||
|
||||
(LPVOID) riid = &iid;
|
||||
fIID = TRUE;
|
||||
}
|
||||
|
||||
if ( s_lOleError == S_OK )
|
||||
s_lOleError = CoCreateInstance( &ClassID, NULL, CLSCTX_SERVER, riid, (LPVOID) &pDisp );
|
||||
|
||||
s_lOleError = CoCreateInstance( &ClassID, NULL, CLSCTX_SERVER, fIID ? &iid : riid, (LPVOID *) (LPVOID) &pDisp );
|
||||
|
||||
hb_retptr( pDisp );
|
||||
}
|
||||
|
||||
@@ -392,7 +410,7 @@ HB_FUNC( OLEGETACTIVEOBJECT ) /* ( cOleName | cCLSID [, cIID ] ) */
|
||||
s_lOleError = GetActiveObject( &ClassID, NULL, &pUnk );
|
||||
|
||||
if ( s_lOleError == S_OK )
|
||||
s_lOleError = pUnk->lpVtbl->QueryInterface( pUnk, riid, (void **) &pDisp );
|
||||
s_lOleError = pUnk->lpVtbl->QueryInterface( pUnk, riid, (void **) ( void * ) &pDisp );
|
||||
}
|
||||
|
||||
hb_retptr( pDisp );
|
||||
@@ -522,7 +540,7 @@ HB_FUNC( HB_OLEAUTO___ONERROR )
|
||||
hb_vmPush( hb_stackSelfItem() );
|
||||
hb_vmSend( 0 );
|
||||
pDisp = ( IDispatch* ) hb_parptr( -1 );
|
||||
|
||||
|
||||
/* TODO: implement hb_clsGetMessageName() */
|
||||
hb_vmPushDynSym( s_pDyns_GetMessage );
|
||||
hb_vmPushNil();
|
||||
|
||||
Reference in New Issue
Block a user