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.

140 lines
4.8 KiB

  1. Copyright (c) 1997-2000 Microsoft Corporation
  2. BURNSLIB: Basic Utility Resource 'N String Library ;->
  3. ==================================================
  4. There are two flavors of this library: the "core" and the "rest."
  5. The core library is the most stable, and most easily used in just about any
  6. application. It consists of the following:
  7. - class String, which is a Windows-aware, enhancement of std::wstring.
  8. - Replacement versions of ::operator new and ::operator delete,
  9. which, among other things allow each allocation to be accompanied
  10. with file, line number and stack trace at the point of allocation.
  11. - class Log, which provides thread-safe diagnostic logging with
  12. output directable to debugger, file, a named pipe.
  13. - A very small set of lightweight COM helpers which do not exhibit
  14. the elephantine nature of MFC and ATL constructs of similar
  15. purpose.
  16. The rest is really meant for my own use, so copy what you like, but don't
  17. expect me to be nice about version control.
  18. To use the core library in your code:
  19. ====================================
  20. In your razzle environment (for chk builds, this causes the linker to use
  21. the debug CRT .lib files and passes -D_DEBUG to the compiler. This is
  22. necessary to use the heap debugging functionality)
  23. set DEBUG_CRTS=1
  24. In your headers.hxx file
  25. Add #include <blcore.hpp> before any headers for code that you want to
  26. use the replacement operator new and delete. (Generally, I only put
  27. include headers from outside my project in headers.hxx. So, I include
  28. blcore.hpp last in my headers.hxx.)
  29. Note that blcore.hpp #includes syscore.hpp, which in turn #includes
  30. several sdk header files. You may want to remove redundant inclusion
  31. of those files.
  32. In your sources file:
  33. Add admin\burnslib\inc to the INCLUDES macro
  34. Add the following to your UNLIBS or TARGETLIBS macro
  35. $(SDXROOT)\admin\burnslib\lib\*\blcore.lib
  36. $(SDK_LIB_PATH)\imagehlp.lib
  37. Add the following lines:
  38. # enable logging for chk builds
  39. !if !$(FREEBUILD)
  40. !MESSAGE defining LOGGING_BUILD
  41. C_DEFINES=$(C_DEFINES) -DLOGGING_BUILD
  42. !ENDIF
  43. # enable Unicode support
  44. C_DEFINES=$(C_DEFINES) -DUNICODE -D_UNICODE
  45. # enable C++ Standard Template Library
  46. USE_STL=1
  47. # enable C++ Exceptions
  48. USE_NATIVE_EH=1
  49. # use msvcrt (C runtimes)
  50. USE_MSVCRT=1
  51. Somewhere in your source code, you need to define the following symbols.
  52. See blcore.hpp for explanations of each.
  53. HINSTANCE hResourceModuleHandle
  54. const wchar_t* RUNTIME_NAME
  55. DWORD DEFAULT_LOGGING_OPTIONS
  56. In your project's resource script (rc) file, #include blcore.rc. These are
  57. the resources for the out-of-memory dialog.
  58. Add your project name to this list so I can update you when changes are
  59. made:
  60. Project Subdir Contact email
  61. --------- ------ -------
  62. admin dcpromo sburns
  63. admin snapin\localsec sburns
  64. admin netid sburns
  65. admin dsutils\migrate\clonepr sburns
  66. admin select\src davidmun
  67. Notes:
  68. =========================
  69. Since you are using the debug CRTs, you will need to have available on your
  70. search path msvcrtd.dll and possibly also msvcp50d.dll (depending on which
  71. STL templates your code uses). This means that you will may need to
  72. include those dlls with any private chk binaries you distribute.
  73. All of BURNSLIB compiles clean with warning level 4, so you can include
  74. MSC_WARNING_LEVEL=/W4 in your sources if you wish.
  75. BURNSLIB is statically linked to your binary. There is no associated dll.
  76. It replaces the global operator new, operator new[], operator delete, and
  77. operator delete[] with private versions. This isolates the behavior of
  78. those operators to your binary. To understand why this is a Good Thing,
  79. see new.doc.
  80. If you plan to use any functions that load resources (strings, icons,
  81. etc.), you need to make sure you set the hResourceModuleHandle to the
  82. HINSTANCE of the binary containing the resource. The best place to do this
  83. is the first line of code in WinMain/DllMain. The design of the library
  84. assumes that all resources are in the same binary; a tradeoff between
  85. simplicity and flexibility. In your code, you can retrieve this handle by
  86. calling Burnslib::GetResourceModuleHandle().
  87. Most of the symbols are in the Burnslib namespace. blcore.hpp specifies
  88. "using namespace Burnslib;" so you don't have to.
  89. To use the "rest" of the library in your code:
  90. =============================================
  91. Cut and paste. Don't link directly to it. I tweak the rest with reckless
  92. abandon and will offer no apologies for breaking your code.
  93. <eof>