#include "gc.h"
#ifndef THINK_CPLUS
-# define GC_cdecl
+# define GC_cdecl GC_CALLBACK
#else
# define GC_cdecl _cdecl
#endif
#endif
#if ! defined ( __BORLANDC__ ) /* Confuses the Borland compiler. */ \
- && ! defined ( __sgi )
+ && ! defined ( __sgi ) && ! defined( __WATCOMC__ ) \
+ && (!defined(_MSC_VER) || _MSC_VER > 1020)
# define GC_PLACEMENT_DELETE
#endif
/* Must be redefined here, since the other overloadings */
/* hide the global definition. */
inline void operator delete( void* obj );
-# ifdef GC_PLACEMENT_DELETE
+# ifdef GC_PLACEMENT_DELETE
+ inline void operator delete( void*, GCPlacement );
+ /* called if construction fails. */
inline void operator delete( void*, void* );
# endif
inline void* operator new[]( size_t size, void *p );
inline void operator delete[]( void* obj );
# ifdef GC_PLACEMENT_DELETE
+ inline void operator delete[]( void*, GCPlacement );
inline void operator delete[]( void*, void* );
# endif
#endif /* GC_OPERATOR_NEW_ARRAY */
member derived from "gc_cleanup", its destructors will be
invoked. */
-extern "C" {typedef void (*GCCleanUpFunc)( void* obj, void* clientData );}
+extern "C" {
+ typedef void (GC_CALLBACK * GCCleanUpFunc)( void* obj, void* clientData );
+}
#ifdef _MSC_VER
// Disable warning that "no matching operator delete found; memory will
classes derived from "gc_cleanup" or containing members derived
from "gc_cleanup". */
+# ifdef GC_PLACEMENT_DELETE
+ inline void operator delete( void*, GCPlacement, GCCleanUpFunc, void * );
+# endif
#ifdef _MSC_VER
/** This ensures that the system default operator new[] doesn't get
* undefined, which is what seems to happen on VC++ 6 for some reason
* if we define a multi-argument operator new[].
- * There seems to be really redirect new in this environment without
+ * There seems to be no way to redirect new in this environment without
* including this everywhere.
*/
+#if _MSC_VER > 1020
void *operator new[]( size_t size );
void operator delete[](void* obj);
+#endif
void* operator new( size_t size);
#ifdef GC_PLACEMENT_DELETE
inline void gc::operator delete( void*, void* ) {}
+
+ inline void gc::operator delete( void* p, GCPlacement gcp ) {
+ GC_FREE(p);
+ }
#endif
#ifdef GC_OPERATOR_NEW_ARRAY
#ifdef GC_PLACEMENT_DELETE
inline void gc::operator delete[]( void*, void* ) {}
+
+ inline void gc::operator delete[]( void* p, GCPlacement gcp ) {
+ gc::operator delete(p); }
+
#endif
#endif /* GC_OPERATOR_NEW_ARRAY */
inline gc_cleanup::~gc_cleanup() {
GC_register_finalizer_ignore_self( GC_base(this), 0, 0, 0, 0 );}
-inline void gc_cleanup::cleanup( void* obj, void* displ ) {
+inline void GC_CALLBACK gc_cleanup::cleanup( void* obj, void* displ ) {
((gc_cleanup*) ((char*) obj + (ptrdiff_t) displ))->~gc_cleanup();}
inline gc_cleanup::gc_cleanup() {
obj = GC_MALLOC_UNCOLLECTABLE( size );};
return obj;}
+# ifdef GC_PLACEMENT_DELETE
+inline void operator delete (
+ void *p,
+ GCPlacement gcp,
+ GCCleanUpFunc cleanup,
+ void* clientData )
+{
+ GC_FREE(p);
+}
+# endif
#ifdef GC_OPERATOR_NEW_ARRAY