Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.3 KiB

  1. #include "common.h"
  2. #include "nfeature.h"
  3. #include "engine.h"
  4. #include "bear.h"
  5. #include <tpgHandle.h>
  6. #include <GeoFeats.h>
  7. HINSTANCE g_hInstanceDll;
  8. BOOL InitAvalanche (HINSTANCE hDll);
  9. BOOL DetachAvalanche();
  10. // July 2001 - mrevow Add heap checking code when DBG is defined
  11. #ifdef DBG
  12. #include <crtdbg.h>
  13. extern void initMemMgr();
  14. extern void destroyMemMgr();
  15. //_CrtMemState g_HeapStateStart, g_HeapStateEnd, g_HeapStateDiff;
  16. #endif
  17. BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
  18. {
  19. if (dwReason == DLL_PROCESS_ATTACH)
  20. {
  21. g_hInstanceDll = hDll;
  22. #ifdef DBG
  23. //initMemMgr();
  24. // _CrtMemCheckpoint(&g_HeapStateStart);
  25. #endif
  26. if (FALSE == initTpgHandleManager())
  27. {
  28. return FALSE;
  29. }
  30. if (!InitBear (hDll))
  31. return FALSE;
  32. if (!InitAvalanche(hDll))
  33. return FALSE;
  34. return InitRecognition(hDll);
  35. }
  36. if (dwReason == DLL_PROCESS_DETACH)
  37. {
  38. DetachBear();
  39. DetachAvalanche();
  40. CloseRecognition();
  41. closeTpgHandleManager();
  42. unloadCharNets();
  43. #ifdef DBG
  44. destroyMemMgr();
  45. // _CrtMemCheckpoint(&g_HeapStateEnd);
  46. //
  47. // if (TRUE == _CrtMemDifference(&g_HeapStateDiff, &g_HeapStateStart, &g_HeapStateEnd))
  48. // {
  49. // _CrtMemDumpStatistics(&g_HeapStateDiff);
  50. // }
  51. // _CrtDumpMemoryLeaks();
  52. #endif
  53. }
  54. return((int)TRUE);
  55. }