root/win32/dllmain.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. DllMain

   1 /*
   2    +----------------------------------------------------------------------+
   3    | PHP Version 7                                                        |
   4    +----------------------------------------------------------------------+
   5    | Copyright (c) 1997-2016 The PHP Group                                |
   6    +----------------------------------------------------------------------+
   7    | This source file is subject to version 3.01 of the PHP license,      |
   8    | that is bundled with this package in the file LICENSE, and is        |
   9    | available through the world-wide-web at the following url:           |
  10    | http://www.php.net/license/3_01.txt                                  |
  11    | If you did not receive a copy of the PHP license and are unable to   |
  12    | obtain it through the world-wide-web, please send a note to          |
  13    | license@php.net so we can mail you a copy immediately.               |
  14    +----------------------------------------------------------------------+
  15    | Authors: Anatol Belski <ab@php.net>                                  |
  16    +----------------------------------------------------------------------+
  17  */
  18 
  19 #include <config.w32.h>
  20 
  21 #include <win32/time.h>
  22 #include <php.h>
  23 
  24 #ifdef HAVE_LIBXML
  25 #include <libxml/threads.h>
  26 #endif
  27 
  28 /* TODO this file, or part of it, could be machine generated, to
  29         allow extensions and SAPIs adding their own init stuff.
  30         However expected is that MINIT is enough in most cases.
  31         This file is only useful for some really internal stuff,
  32         eq. initializing something before the DLL even is
  33         available to be called. */
  34 
  35 BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID dummy)
  36 {
  37         BOOL ret = TRUE;
  38 
  39         switch (reason)
  40         {
  41                 case DLL_PROCESS_ATTACH:
  42                         ret = ret && php_win32_init_gettimeofday();
  43                         if (!ret) {
  44                                 fprintf(stderr, "gettimeofday() initialization failed");
  45                                 return ret;
  46                         }
  47                         break;
  48 #if 0 /* prepared */
  49                 case DLL_PROCESS_DETACH:
  50                         /* pass */
  51                         break;
  52 
  53                 case DLL_THREAD_ATTACH:
  54                         /* pass */
  55                         break;
  56 
  57                 case DLL_THREAD_DETACH:
  58                         /* pass */
  59                         break;
  60 #endif
  61         }
  62 
  63 #ifdef HAVE_LIBXML
  64         /* This imply that only LIBXML_STATIC_FOR_DLL is supported ATM. 
  65                 If that changes, this place will need some rework. 
  66            TODO Also this should be revisited as no initialization
  67                 might be needed for TS build (libxml build with TLS
  68                 support. */
  69         ret = ret && xmlDllMain(inst, reason, dummy);
  70 #endif
  71 
  72         return ret;
  73 }
  74 

/* [<][>][^][v][top][bottom][index][help] */