dllinit.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifdef WIN32
  2. /* dllinit.c -- Portable DLL initialization.
  3. Copyright (C) 1998, 1999 Free Software Foundation, Inc.
  4. Contributed by Mumit Khan ([email protected]).
  5. I've used DllMain as the DLL "main" since that's the most common
  6. usage. MSVC and Mingw32 both default to DllMain as the standard
  7. callback from the linker entry point. Cygwin, as of b20.1, also
  8. uses DllMain as the default callback from the entry point.
  9. The real entry point is typically always defined by the runtime
  10. library, and usually never overridden by (casual) user. What you can
  11. override however is the callback routine that the entry point calls,
  12. and this file provides such a callback function, DllMain.
  13. Mingw32: The default entry point for mingw32 is DllMainCRTStartup
  14. which is defined in libmingw32.a This in turn calls DllMain which is
  15. defined here. If not defined, there is a stub in libmingw32.a which
  16. does nothing.
  17. Cygwin: The default entry point for Cygwin b20.1 or newer is
  18. __cygwin_dll_entry which is defined in libcygwin.a. This in turn
  19. calls the routine DllMain. If not defined, there is a stub in
  20. libcygwin.a which does nothing.
  21. MSVC: MSVC runtime calls DllMain, just like Mingw32.
  22. Summary: If you need to do anything special in DllMain, just add it
  23. here. Otherwise, the default setup should be just fine for 99%+ of
  24. the time. I strongly suggest that you *not* change the entry point,
  25. but rather change DllMain as appropriate.
  26. */
  27. #define WIN32_LEAN_AND_MEAN
  28. #include <windows.h>
  29. #undef WIN32_LEAN_AND_MEAN
  30. #include <stdio.h>
  31. BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason,
  32. LPVOID reserved /* Not used. */ );
  33. /*
  34. *----------------------------------------------------------------------
  35. *
  36. * DllMain --
  37. *
  38. * This routine is called by the Mingw32, Cygwin32 or VC++ C run
  39. * time library init code, or the Borland DllEntryPoint routine. It
  40. * is responsible for initializing various dynamically loaded
  41. * libraries.
  42. *
  43. * Results:
  44. * TRUE on sucess, FALSE on failure.
  45. *
  46. * Side effects:
  47. *
  48. *----------------------------------------------------------------------
  49. */
  50. BOOL APIENTRY
  51. DllMain (
  52. HINSTANCE hInst /* Library instance handle. */ ,
  53. DWORD reason /* Reason this function is being called. */ ,
  54. LPVOID reserved /* Not used. */ )
  55. {
  56. switch (reason)
  57. {
  58. case DLL_PROCESS_ATTACH:
  59. break;
  60. case DLL_PROCESS_DETACH:
  61. break;
  62. case DLL_THREAD_ATTACH:
  63. break;
  64. case DLL_THREAD_DETACH:
  65. break;
  66. }
  67. return TRUE;
  68. }
  69. #else
  70. #ifdef VMS
  71. int VOID_VAR_DLLINIT;
  72. #endif
  73. #endif
  74. /*
  75. * local variables:
  76. * eval: (load-file "../curl-mode.el")
  77. * end:
  78. * vim600: fdm=marker
  79. * vim: et sw=2 ts=2 sts=2 tw=78
  80. */