diff --git a/harbour/source/vm/dynlibhb.c b/harbour/source/vm/dynlibhb.c index 1f91ab19d7..dfb3206e23 100644 --- a/harbour/source/vm/dynlibhb.c +++ b/harbour/source/vm/dynlibhb.c @@ -61,6 +61,10 @@ #include "hbstack.h" #include "hbvm.h" +#if defined(HB_OS_WIN_32) + extern HMODULE _hInstance; +#endif + HB_FUNC( LIBLOAD ) { #if defined(HB_OS_WIN_32) @@ -113,3 +117,21 @@ HB_FUNC( HB_LIBDO ) } } + +/* It returns TRUE if this function is called from the main app (EXE) + * and FALSE if it is called from a dynamic library (DLL) + * -please update the mentioned extensions for other OS- + */ + +BOOL hb_StartApp( void ) +{ +#if defined(HB_OS_WIN_32) + { + return ( BOOL ) ( _hInstance == GetModuleHandle( NULL ) ); + } +#else + { + return TRUE; /* Warning: this must be changed for other OS */ + } +#endif +} \ No newline at end of file