sourcepawn/decompiler/platform_util.cpp
changeset 2325 7a24ee5557fb
parent 2320 88550c031d23
     1.1 --- a/sourcepawn/decompiler/platform_util.cpp	Fri Sep 26 19:10:40 2008 +1200
     1.2 +++ b/sourcepawn/decompiler/platform_util.cpp	Sat Sep 27 15:34:59 2008 -0500
     1.3 @@ -1,4 +1,6 @@
     1.4 +#include <new>
     1.5  #include <stdio.h>
     1.6 +#include <stdlib.h>
     1.7  #include "platform_util.h"
     1.8  
     1.9  size_t Sp_Format(char *buffer, size_t maxlength, const char *fmt, ...)
    1.10 @@ -30,3 +32,29 @@
    1.11  	}
    1.12  }
    1.13  
    1.14 +/* Overload a few things to prevent libstdc++ linking */
    1.15 +#if defined __linux__
    1.16 +extern "C" void __cxa_pure_virtual(void)
    1.17 +{
    1.18 +}
    1.19 +
    1.20 +void *operator new(size_t size)
    1.21 +{
    1.22 +	return malloc(size);
    1.23 +}
    1.24 +
    1.25 +void *operator new[](size_t size) 
    1.26 +{
    1.27 +	return malloc(size);
    1.28 +}
    1.29 +
    1.30 +void operator delete(void *ptr) 
    1.31 +{
    1.32 +	free(ptr);
    1.33 +}
    1.34 +
    1.35 +void operator delete[](void * ptr)
    1.36 +{
    1.37 +	free(ptr);
    1.38 +}
    1.39 +#endif