Leaked source code of windows server 2003
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.

66 lines
1.4 KiB

  1. //
  2. // Code to help free modules from the bondage and tyranny of CRT libraries
  3. //
  4. // Include this header in a single component and #define CPP_FUNCTIONS
  5. //
  6. #if defined(__cplusplus) && defined(CPP_FUNCTIONS)
  7. void * __cdecl operator new(size_t nSize)
  8. {
  9. // Zero init just to save some headaches
  10. return((LPVOID)LocalAlloc(LPTR, nSize));
  11. }
  12. void __cdecl operator delete(void *pv)
  13. {
  14. LocalFree((HLOCAL)pv);
  15. }
  16. extern "C" int __cdecl _purecall(void) {return 0;}
  17. #endif
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #if defined(DEFINE_FLOAT_STUFF)
  22. // If you aren't using any floating-point CRT functions and you know
  23. // you aren't performing any float conversions or arithmetic, yet the
  24. // linker wants these symbols declared, then define DEFINE_FLOAT_STUFF.
  25. //
  26. // Warning: declaring these symbols in a component that needs floating
  27. // point support from the CRT will produce undefined results. (You will
  28. // need fp support from the CRT if you simply perform fp arithmetic.)
  29. int _fltused = 0;
  30. void __cdecl _fpmath(void) { }
  31. #endif
  32. #ifdef __cplusplus
  33. };
  34. #endif
  35. //
  36. // This file should be included in a global component header
  37. // to use the following
  38. //
  39. #ifndef __CRTFREE_H_
  40. #define __CRTFREE_H_
  41. #ifdef __cplusplus
  42. #ifndef _M_PPC
  43. #pragma intrinsic(memcpy)
  44. #pragma intrinsic(memcmp)
  45. #pragma intrinsic(memset)
  46. #endif
  47. #endif
  48. #endif // __CRTFREE_H_