home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pmstabar.zip / dllmain.h < prev    next >
C/C++ Source or Header  |  2002-01-27  |  2KB  |  84 lines

  1. //========================================================================
  2. // dllmain.h : definitions of global variables, macros, structures
  3. //             These definitions should only be available to the DLL sources
  4. //========================================================================
  5.  
  6. // header inclusions
  7.  
  8. #ifndef COMMON_H_
  9.    #define COMMON_H_
  10.    #define INCL_WIN
  11.    #define INCL_GPI
  12.    #define INCL_DOS
  13. //   #define INCL_DOSMISC
  14. //   #define INCL_DOSPROCESS
  15. //   #define INCL_DOSSEMAPHORES
  16. //   #define INCL_DOSMODULEMGR
  17. //   #define INCL_SHLERRORS
  18.  
  19.    #include <os2.h>
  20.    #include <stdlib.h>
  21.    #include <malloc.h>
  22.    #include <string.h>
  23.    #include "ApiExPM.h"
  24.    #include "ctrlutil.h"
  25.  
  26. // conditional compilation macros:
  27. //#define MULTITHREADLIB    // comment to compile as single thread library
  28. #define BUILD_TEST_EXE    // builds the program as a test executable
  29.  
  30.  
  31. // common usage macros
  32. // aligns n to the next m multiple (where m is a power of 2)
  33. #define RNDUP(n, m)   (((ULONG)(n) + (m) - 1) & ~((m) - 1))
  34. // aligns n to the previous m multiple (where m is a power of 2)
  35. #define RNDDWN(n, m)  ((ULONG)(n) & ~((m) - 1))
  36.  
  37. // memory allocation management macros
  38. #ifdef BUILD_TEST_EXE
  39.    #define memalloc(cb)          (malloc(cb))
  40.    #define memfree(p)            (free(p))
  41.    #define memheapmin()          (_heapmin())
  42. #else
  43.    #ifdef MULTITHREADLIB
  44.       #define memalloc(cb)          (_mtalloc(cb))
  45.       #define memfree(p)            (_mtfree(p))
  46.       #define memheapmin()          (_mtheapmin())
  47.    #else
  48.       #define memalloc(cb)          (_stalloc(cb))
  49.       #define memfree(p)            (_stfree(p))
  50.       #define memheapmin()          (_stheapmin())
  51.    #endif // ifdef MULTITHREADLIB
  52. #endif // #ifdef BUILD_TEST_EXE
  53.  
  54. // globals
  55.  
  56. typedef struct {
  57.    HMODULE hmod;
  58.    CLASSINFO ci;
  59.    HPOINTER hHandClick;
  60. } GLOBALS, * PGLOBALS;
  61.  
  62. extern GLOBALS g;
  63.  
  64.  
  65. // exported APIs
  66. // bar.c
  67. BOOL APIENTRY BarRegister(HAB hab);
  68. BOOL APIENTRY WzBtnRegister(HAB hab);
  69.  
  70.  
  71. // other prototypes:
  72.  
  73. // dllmain.c
  74. VOID heapLock(VOID);
  75. VOID heapUnlock(VOID);
  76. PVOID _stalloc(ULONG cb);
  77. PVOID _mtalloc(ULONG cb);
  78. VOID _stfree(PVOID pv);
  79. VOID _mtfree(PVOID pv);
  80. VOID _stheapmin(VOID);
  81. VOID _mtheapmin(VOID);
  82.  
  83. #endif
  84.