home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / OWLSRC.PAK / LIBMAIN.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  1.5 KB  |  55 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1991, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.13  $
  6. //
  7. // Default implementation of DLlEntryPoint()/LibMain() for user DLLs
  8. //----------------------------------------------------------------------------
  9. #include <owl/pch.h>
  10. #if !defined(OWL_APPLICAT_H)
  11. # include <owl/applicat.h>
  12. #endif
  13.  
  14. OWL_DIAGINFO;
  15. DIAG_DECLARE_GROUP(OwlMain);
  16.  
  17. #if defined(BI_PLAT_WIN32)
  18.  
  19. int WINAPI
  20. DllEntryPoint(HINSTANCE hInstance, uint32 reason, LPVOID)
  21. {
  22.   TRACEX(OwlMain, 0, "DllEntryPoint(" << hInstance << ", " << reason << ", " <<
  23.          ") called");
  24.  
  25.   switch (reason) {
  26.     case DLL_PROCESS_ATTACH:
  27.  
  28.       // If you provide your own version of DLL EntryPoint, make sure
  29.       // you call OwlInitUserDLL to allow OWL to initialize '::Module'
  30.       //
  31.       return OWLInitUserDLL(hInstance, 0) ? 1 : 0;
  32.   }
  33.   return 1;
  34. }
  35.  
  36. #else   // !defined(BI_PLAT_WIN32)
  37.  
  38. int
  39. FAR PASCAL
  40. LibMain(HINSTANCE   hInstance,
  41.         WORD      /*wDataSeg*/,
  42.         WORD      /*cbHeapSize*/,
  43.         LPSTR       cmdLine)
  44. {
  45.   TRACEX(OwlMain, 0, "LibMain(" << hex << uint(hInstance) << ", " <<
  46.                                   TResId(cmdLine)  << ") called");
  47.  
  48.   // Allow OWL to initialize global '::Module' pointer and store
  49.   // cmdLine information...
  50.   //
  51.   return OWLInitUserDLL(hInstance, cmdLine) ? 1 : 0;
  52. }
  53.  
  54. #endif  // defined(BI_PLAT_WIN32)
  55.