Team Fortress 2 Source Code as on 22/4/2020
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.

34 lines
1.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Add a specially formatted string to each debug library of the form
  4. // "%LIBNAME%.lib is built debug!". We can search for this string via
  5. // a Perforce trigger to ensure that debug LIBs are not checked in.
  6. //
  7. // Also added a global int that is emitted only in release builds so
  8. // that release DLLs and EXEs can ensure that they are linking to
  9. // release versions of LIBs at link time. The global int adhere to the
  10. // naming convention "%LIBNAME%_lib_is_a_release_build".
  11. //
  12. // To take advantage of this pattern a DLL or EXE should add code
  13. // at global scope similar to the following in one of its modules:
  14. //
  15. // #if !defined(_DEBUG)
  16. // extern int bitmap_lib_is_a_release_build;
  17. //
  18. // void DebugTestFunction()
  19. // {
  20. // bitmap_lib_is_a_release_build = 0;
  21. // }
  22. // #endif
  23. //
  24. //=============================================================================//
  25. #if defined(DEBUG) || defined(_DEBUG)
  26. #define _DEBUGONLYSTRING(x) #x
  27. #define DEBUGONLYSTRING(x) _DEBUGONLYSTRING(x)
  28. static volatile char const *pDebugString = DEBUGONLYSTRING(LIBNAME) ".lib is built debug!";
  29. #else
  30. #define _RELONLYINT(x) int x ## _lib_is_a_release_build = 0
  31. #define RELONLYINT(x) _RELONLYINT(x)
  32. RELONLYINT(LIBNAME);
  33. #endif