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.

77 lines
1.5 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. #include "mem.h"
  8. #undef new
  9. void * __cdecl operator new(size_t nSize)
  10. {
  11. return cicMemAllocClear((UINT)nSize);
  12. }
  13. void __cdecl operator delete(void *pv)
  14. {
  15. cicMemFree(pv);
  16. }
  17. void __cdecl operator delete[]( void * p )
  18. {
  19. operator delete(p);
  20. }
  21. void * __cdecl operator new[]( size_t cb )
  22. {
  23. return operator new(cb);
  24. }
  25. extern "C" int __cdecl _purecall(void) {return 0;}
  26. #endif
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. #if defined(DEFINE_FLOAT_STUFF)
  31. // If you aren't using any floating-point CRT functions and you know
  32. // you aren't performing any float conversions or arithmetic, yet the
  33. // linker wants these symbols declared, then define DEFINE_FLOAT_STUFF.
  34. //
  35. // Warning: declaring these symbols in a component that needs floating
  36. // point support from the CRT will produce undefined results. (You will
  37. // need fp support from the CRT if you simply perform fp arithmetic.)
  38. int _fltused = 0;
  39. void __cdecl _fpmath(void) { }
  40. #endif
  41. #ifdef __cplusplus
  42. };
  43. #endif
  44. //
  45. // This file should be included in a global component header
  46. // to use the following
  47. //
  48. #ifndef __CRTFREE_H_
  49. #define __CRTFREE_H_
  50. #ifdef __cplusplus
  51. #ifndef _M_PPC
  52. #pragma intrinsic(memcpy)
  53. #pragma intrinsic(memcmp)
  54. #pragma intrinsic(memset)
  55. #endif
  56. #endif
  57. #endif // __CRTFREE_H_