;; Most symbols in the google-perftools dll are exported via
;; __declspec(dllexport).  This works fine for functions we're
;; defining ourselves, but not for functions we're overriding, like
;; malloc, free, and new.  Those already have an export spec in
;; msvcrt.dll.  (In particular, they're already declared internally in
;; a header that exists in the compiler's own static data, and there's
;; no way to override inclusion of that header.)  Since that header
;; doesn't declare these functions dllexport, we can't redeclare them
;; dllexport.
;;
;; For malloc, calloc, realloc, and free, not only can we not override
;; the declaration, we can't override the definition: windows does not
;; provide "weak" linkage for these functions (in general).
;; The way we deal with these functions in code is to patch the
;; assembly code for the Windows malloc/etc to point to our
;; functions.  Using this technique, there's no need to declare our
;; own version of malloc/etc anywhere: we do our own "exporting" when
;; we patch up the assembly code.
;;
;; For new and delete, we *can* override the definition.  That means
;; we need to export our declaration.  As mentioned, we can't
;; redeclare them dllexport in our .h file.  The only other way to
;; export a declaration is to declare it here, in a .def file.
;; We export the 4 versions of new and delete that  we override:
;;     ??2@YAPAXI@Z    (void * __cdecl operator new(unsigned int))
;;     ??3@YAXPAX@Z    (void __cdecl operator delete(void *))
;;     ??_U@YAPAXI@Z   (void * __cdecl operator new[](unsigned int))
;;     ??_V@YAXPAX@Z   (void __cdecl operator delete[](void *))
;;     ??2@YAPAXIABUnothrow_t@std@@@Z    (void * __cdecl operator new(unsigned int,struct std::nothrow_t const &))
;;     ??3@YAXPAXABUnothrow_t@std@@@Z    (void __cdecl operator delete(void *,struct std::nothrow_t const &))
;;     ??_U@YAPAXIABUnothrow_t@std@@@Z   (void * __cdecl operator new[](unsigned int,struct std::nothrow_t const &))
;;     ??_V@YAXPAXABUnothrow_t@std@@@Z   (void __cdecl operator delete[](void *,struct std::nothrow_t const &))
;;
;; (The first field is the mangled name, and the stuff in parens is
;; the unmangled name.  Mangling can change from compiler-version to
;; compiler-version; the mangling above is good for at least VC++ 7.1
;; and VC++ 8.0.)
;;
;; To figure out the mangled names, I compiled tcmalloc.obj
;; (tcmalloc.cc is the file that overrides these operators), and ran
;; "dumpbin /symbols" on tcmalloc.obj.  I then did a grep (in unix :-) )
;; over the output, looking for "operator".  This showed the 8
;; operator new and operator delete calls in tcmalloc.cc, plus a
;; placement new and placement delete that I ignored.
;;
;; Finally, for the memory-allocation routines that tcmalloc defines
;; but windows doesn't -- cfree, posix_memalign, etc -- I *could* put
;; a dllexport in the .h file where I declare them, since there's no
;; windows declaration to worry about.  But I put them here instead,
;; partly to avoid the extra verbiage in the source code, and partly
;; to keep all the export info for the memory-allocation functions
;; together.

EXPORTS
  ??2@YAPAXI@Z
  ??3@YAXPAX@Z
  ??_U@YAPAXI@Z
  ??_V@YAXPAX@Z
  ??2@YAPAXIABUnothrow_t@std@@@Z
  ??3@YAXPAXABUnothrow_t@std@@@Z
  ??_U@YAPAXIABUnothrow_t@std@@@Z
  ??_V@YAXPAXABUnothrow_t@std@@@Z
  cfree
  posix_memalign
  memalign
  valloc
  pvalloc
