Linux compatibility for no-STL
authorDavid Anderson <dvander@alliedmods.net>
Tue Sep 13 20:20:49 2005 +0000 (2005-09-13)
changeset 106ae2defdde073
parent 105 9ae101979935
child 107 1d6e7e0bdcd9
Linux compatibility for no-STL
sourcemm/ISmmAPI.h
sourcemm/Makefile
sourcemm/sourcemm.cpp
     1.1 --- a/sourcemm/ISmmAPI.h	Tue Sep 13 19:31:25 2005 +0000
     1.2 +++ b/sourcemm/ISmmAPI.h	Tue Sep 13 20:20:49 2005 +0000
     1.3 @@ -24,7 +24,7 @@
     1.4  
     1.5  #if defined __GNUC__
     1.6  #if ((__GNUC__ == 3) && (__GNUC_MINOR__ < 4)) || (__GNUC__ < 3)
     1.7 -#error "You must compile with at least GCC 3.4! If you know what you are doing, you can remove this message."
     1.8 +//#error "You must compile with at least GCC 3.4! If you know what you are doing, you can remove this message."
     1.9  #endif //version check
    1.10  #endif //__GNUC__
    1.11  
     2.1 --- a/sourcemm/Makefile	Tue Sep 13 19:31:25 2005 +0000
     2.2 +++ b/sourcemm/Makefile	Tue Sep 13 20:20:49 2005 +0000
     2.3 @@ -9,13 +9,13 @@
     2.4  
     2.5  OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
     2.6  DEBUG_FLAGS = -g -ggdb3
     2.7 -CPP = g++
     2.8 +CPP = gcc
     2.9  BINARY = server_i486.so
    2.10  
    2.11  OBJECTS = oslink.cpp util.cpp convar.cpp concommands.cpp \
    2.12  	CSmmAPI.cpp sourcemm.cpp CPlugin.cpp sourcehook.cpp
    2.13  
    2.14 -LINK = vstdlib_i486.so tier0_i486.so
    2.15 +LINK = vstdlib_i486.so tier0_i486.so -static-libgcc
    2.16  
    2.17  HL2PUB = $(HL2SDK)/public
    2.18  
    2.19 @@ -30,7 +30,7 @@
    2.20  	CFLAGS = $(OPT_FLAGS)
    2.21  endif
    2.22  
    2.23 -CFLAGS += -fpermissive -D_LINUX -DNDEBUG -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -fPIC -Wno-deprecated
    2.24 +CFLAGS += -fpermissive -D_LINUX -DNDEBUG -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -fPIC -Wno-deprecated -fno-exceptions -fno-rtti
    2.25  
    2.26  OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
    2.27  
     3.1 --- a/sourcemm/sourcemm.cpp	Tue Sep 13 19:31:25 2005 +0000
     3.2 +++ b/sourcemm/sourcemm.cpp	Tue Sep 13 20:20:49 2005 +0000
     3.3 @@ -466,3 +466,23 @@
     3.4  
     3.5  	return m_pOrig->LevelInit(pMapName, pMapEntities, pOldLevel, pLandmarkName, loadGame, background);
     3.6  }
     3.7 +
     3.8 +#if defined __GNUC__ && (__GNUC__ == 3)
     3.9 +void * ::operator new(size_t size) {
    3.10 +	return(calloc(1, size)); 
    3.11 +}
    3.12 +
    3.13 +void * ::operator new[](size_t size) {
    3.14 +	return(calloc(1, size)); 
    3.15 +}
    3.16 +
    3.17 +void ::operator delete(void * ptr) {
    3.18 +	if(ptr)
    3.19 +		free(ptr);
    3.20 +}
    3.21 +
    3.22 +void ::operator delete[](void * ptr) {
    3.23 +	if(ptr)
    3.24 +		free(ptr);
    3.25 +}
    3.26 +#endif