home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / odbc_hlp.zip / odbctran.zip / LIBMAIN.C < prev    next >
C/C++ Source or Header  |  1995-06-01  |  2KB  |  64 lines

  1.  
  2.                 /*-----------------------------+
  3.                 |           LibMain            |
  4.                 +------------------------------+
  5.                 |   main routine for library   |
  6.                 +-----------------------------*/
  7.  
  8. /*----------------+
  9. |  Include files  |
  10. +----------------*/
  11.  
  12. #include "os2.h"
  13.  
  14. HAB NEAR BQEHINST = 0;           // anchor block 
  15. HMODULE NEAR BQEHMOD = 0;        // Library instance handle 
  16.  
  17. extern "C" {
  18. int _CRT_init(void);         // Run time library init
  19. void __ctordtorInit(void);     // constructor destructor init    
  20. void _CRT_term(void);         // Run time library term
  21. void __ctordtorTerm(void);     // constructor destructor term
  22. }
  23.  
  24. extern "C" {
  25. ULONG _DLL_InitTerm(ULONG hInstance, ULONG termFlag)
  26. {
  27. /*--------------------------------------------------------------+
  28. |  Purpose: This is the main routine for the TRANSLATION DLL    |
  29. |                                                               |
  30. |  Author: Joe Vas                      Date: June 1995        |
  31. |                                                               |
  32. |  Copyright: 1987-1995 INTERSOLV, Inc.                        |
  33. |                                                               |
  34. |       This software contains confidential and proprietary     |
  35. |       information of INTERSOLV, Inc.                |
  36. +--------------------------------------------------------------*/
  37.  
  38.     switch(termFlag) {
  39.         case 0:
  40. //
  41. // The C run-time environment initialization function must be     
  42. // called before any calls to C run-time functions that are not   
  43. // inlined.                                                       
  44. //
  45.             if (_CRT_init() == -1)
  46.                 return 0;
  47.             __ctordtorInit();
  48.             BQEHMOD = hInstance;
  49.             BQEHINST = WinQueryAnchorBlock(HWND_DESKTOP);
  50.             break;
  51.  
  52.  
  53.         case 1 :
  54.             __ctordtorTerm();
  55.             _CRT_term();
  56.             break;
  57.         
  58.     }
  59.     return (1);
  60.     
  61. }
  62. }  // End of Extern C
  63.  
  64.