unsigned long _System
_DLL_InitTerm (unsigned long hModule,
               unsigned long termination)
#endif
{
    if (termination) {
        /* Unloading the DLL */
        cairo_os2_fini ();

#ifndef __WATCOMC__
        /* Uninitialize RTL of GCC */
        __ctordtorTerm ();
        _CRT_term ();
#endif
        return 1;
    } else {
        /* Loading the DLL */
#ifndef __WATCOMC__
        /* Initialize RTL of GCC */
        if (_CRT_init () != 0)
            return 0;
        __ctordtorInit ();
#endif

        cairo_os2_init ();
        return 1;
    }
}
unsigned long _System
_DLL_InitTerm (unsigned long hModule, unsigned long ulFlag)
{
  static char location[CCHMAXPATH];

  switch (ulFlag)
    {
      case 0:
        if (_CRT_init () == -1)
          return 0;

        __ctordtorInit();

        /* See http://cyberkinetica.homeunix.net/os2tk45/cp1/1247_L2H_DosQueryModuleNameSy.html
           for specification of DosQueryModuleName(). */
        if (DosQueryModuleName (hModule, sizeof (location), location))
          return 0;

        _fnslashify (location);
        shared_library_fullname = strdup (location);
        break;

      case 1:
        __ctordtorTerm();

        _CRT_term ();
        break;
    }

  return 1;
}
Beispiel #3
0
unsigned long _System _DLL_InitTerm(unsigned long hmod, unsigned long flag)
{
    VLC_UNUSED (hmod);

    switch (flag)
    {
        case 0 :    /* Initialization */
            if(_CRT_init() == -1)
                return 0;

            vlc_mutex_init (&super_mutex);
            vlc_cond_init (&super_variable);
            vlc_threadvar_create (&thread_key, NULL);
            vlc_rwlock_init (&config_lock);
            vlc_rwlock_init (&msg_lock);
            vlc_CPU_init ();

            return 1;

        case 1 :    /* Termination */
            vlc_rwlock_destroy (&msg_lock);
            vlc_rwlock_destroy (&config_lock);
            vlc_threadvar_delete (&thread_key);
            vlc_cond_destroy (&super_variable);
            vlc_mutex_destroy (&super_mutex);

            _CRT_term();

            return 1;
    }

    return 0;   /* Failed */
}
Beispiel #4
0
extern "C" unsigned long _System _DLL_InitTerm(unsigned long hModule,
                                               unsigned long ulFlag)
{
  switch (ulFlag) {
  case 0 :
    // Init: Prime compiler run-time and construct static C++ objects.
    if ( _CRT_init() == -1 ) {
      return 0UL;
    } else {
      __ctordtorInit();
      hInst = hModule;
    }
    break;
    
  case 1 :
    __ctordtorTerm();
    _CRT_term();
    hInst = NULLHANDLE;
    break;
    
  default  :
    return 0UL;
  }

  return 1;
}
Beispiel #5
0
/*
   there are other ways to query the module handle
   but this one seems simple enough
   we need the module handle in wpModifyMenu
   so that we can load our menu via wpInsertPopupMenuItems
*/
ULONG APIENTRY _DLL_InitTerm(ULONG modhandle,ULONG flag)
{
    if(flag == 0)
    {
        if (_CRT_init())
        {
            return 0; /* fail */
        }
#ifdef __cplusplus
        __ctordtorInit();
#endif
        g_hModule   = modhandle;
        return 1;
    }
    else if (flag == 1)
    {
#ifdef __cplusplus
        __ctordtorTerm();
#endif

        _CRT_term();

        return 1; /* success */
    }
    else
    {
        return 0;
    }
}
Beispiel #6
0
ULONG DLL_EXPORT_INFIX _DLL_InitTerm (HMODULE hModule, ULONG dwFlag)
{
	switch (dwFlag)
	{
	
	case 0:
		/* Process init.  Initialize run-time library. */
		if (-1 == _CRT_init ())
			return ((ULONG) 0);

		/* Save the instance handle */
		hDllInstance = hModule;
		break;

	case 1:
		/* Process Term. Deregister extension manager callbacks */
		ExtClear ();
		
		/* Shut down run-time library. */
		_CRT_term ();
		break;
	}

	return ((ULONG) 1);
}
Beispiel #7
0
unsigned long _DLL_InitTerm(unsigned long mod,unsigned long flag)
{
        switch (flag) {
        case 0: /*called on init*/
                _CRT_init();
                vendorShellWidgetClass = (WidgetClass)(&vendorShellClassRec);
                return 1;
        case 1: /*called on exit*/
                return 1;
        default:
                return 0;
        }
}
Beispiel #8
0
/**
 * Initialize/terminate DLL at load/unload.
 */
unsigned long _System _DLL_InitTerm(unsigned long hModule, unsigned long ulFlag)
{
  // Make sure ghModule is initialized, TRACE needs it.
  if (ghModule == NULLHANDLE)
    ghModule = hModule;

  TRACE("hModule %lx, ulFlag %lu\n", hModule, ulFlag);

  switch (ulFlag)
  {
    /*
     * InitInstance. Note that this one is NOT called in a forked child — it's
     * assumed that the DLLs are already initialized in the parent and the child
     * receives an already initialized copy of DLL data. However, in some cases
     * this is not actually true (examples are OS/2 file handles, semaphores and
     * other resources that require special work besides data segment duplication
     * to be available in the child process) and LIBCx is one of these cases.
     * A solution here is to call shared_init() from a fork completion callback
     * (see forkCompletion() below).
     */
    case 0:
    {
      if (_CRT_init() != 0)
        return 0;
      __ctordtorInit();
      shared_init();
      break;
    }

    /*
     * TermInstance. Called for everybody including forked children. We don't
     * call shared_term() from here at all and prefer a process exit hook
     * instead (see its description below).
     */
    case 1:
    {
      __ctordtorTerm();
      _CRT_term();
      break;
    }

    default:
      return 0;
  }

  /* Success */
  return 1;
}
Beispiel #9
0
 unsigned long _System _DLL_InitTerm(unsigned long hModule, unsigned long ulFlag)
 {
    switch (ulFlag)
    {
    case 0 :
       if (_CRT_init() == -1)
          return 0UL;
       memset(&icqskin_dataBlock,0,sizeof(icqskin_dataBlock));
       break;

    case 1 :
       break;

    default  :
       return 0UL;
    }

    module = hModule;
    return 1UL;
 }
Beispiel #10
0
unsigned long _System _DLL_InitTerm(unsigned long hModule, unsigned long
                                    ulFlag)
{
    DLLInstance = (HMODULE) hModule;
    switch (ulFlag)
    {
        case 0:
            if ( _CRT_init() == -1 )
            {
                return(0UL);
            }
#if defined ( __cplusplus )
            __ctordtorInit();
#endif

#ifndef  STATIC_LINK

         /*******************************************************************/
         /* A DosExitList routine must be used to clean up if runtime calls */
         /* are required at exit and the runtime is dynamically linked.     */
         /*******************************************************************/

            DosExitList(0x0000FF00|EXLST_ADD, cleanup);
#endif
            break;
        case 1:

#if defined ( __cplusplus )
            __ctordtorTerm();
#endif

#ifdef  STATIC_LINK
            _CRT_term();
#endif
            break;
    }

    return 1;
}
extern "C" unsigned long _System _DLL_InitTerm(unsigned long hModule, unsigned long ulFlag)
{
    APIRET rc;

    switch (ulFlag) {
    case 0:
        // Init: Prime compiler run-time and construct static C++ objects.
        if ( _CRT_init() == -1 ) {
            return 0UL;
        } else {
            __ctordtorInit();
            hInst = hModule;
            char szFileName[_MAX_PATH];
            GetINIFileName(hInst, szFileName, sizeof(szFileName));
            char sz[256];
            XP_GetPrivateProfileString(SECTION_PREFERENCES, KEY_LOADSTATUS_WINDOW, ENTRY_NO, sz, sizeof(sz), szFileName);
            if (stricmp(sz, ENTRY_YES) == 0)
                hWndLoadStatus = ShowLoadStatus("Tester dll is loaded");
        }
        break;

    case 1 :
        __ctordtorTerm();
        _CRT_term();
        hInst = NULLHANDLE;
        if (hWndLoadStatus)
            DestroyLoadStatus(hWndLoadStatus);

        break;

    default  :
        return 0UL;
    }

    return 1;
}
Beispiel #12
0
unsigned long _DLL_InitTerm(unsigned long mod_handle, unsigned long flag)
{
    switch (flag)
    {
        case 0:
            if (_CRT_init())
                return 0;
            __ctordtorInit();

            /* Ignore fatal signals */
            signal(SIGSEGV, SIG_IGN);
            signal(SIGFPE, SIG_IGN);

            return 1;

        case 1:
            __ctordtorTerm();
            _CRT_term();
            return 1;

        default:
            return 0;
    }
}