From 5f319a527fd657d54046038acaa069d0094e5080 Mon Sep 17 00:00:00 2001 From: Pavol Marko Date: Sun, 7 Mar 2004 18:54:35 +0000 Subject: [PATCH] Fixed GiveFnPtrsToDll linux problems --- dlls/cstrike/Makefile | 28 ++++++++++++++++++---------- dlls/cstrike/cstrike.cpp | 6 +++++- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/dlls/cstrike/Makefile b/dlls/cstrike/Makefile index 7e23a9ca..503e9fb6 100755 --- a/dlls/cstrike/Makefile +++ b/dlls/cstrike/Makefile @@ -1,16 +1,15 @@ -MODNAME = csstats_mm -SRCFILES = cstrike.cpp +MODNAME = cstrike_mm +SRCFILES = cstrike.cpp CstrikePlayer.cpp EXTRA_LIBS_LINUX = EXTRA_LIBS_WIN32 = EXTRA_LIBDIRS_LINUX = -Lextra/lib_linux EXTRA_LIBDIRS_WIN32 = -Lextra/lib_win32 -EXTRA_INCLUDEDIRS = -Iextra/include -I../amxmodx +EXTRA_INCLUDEDIRS = -Iextra/include EXTRA_FLAGS = -Dstrcmpi=strcasecmp -AMXDIR=../amxmodx SDKTOP=../hlsdk METADIR=../metamod/metamod @@ -53,34 +52,43 @@ else ASRCFILES := $(shell dir /b) endif OBJ_LINUX := $(SRCFILES:%.cpp=$(OBJDIR_LINUX)/%.o) +OBJC_LINUX := $(CSRCFILES:%.c=$(OBJDIR_LINUX)/%.o) OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o) +OBJC_WIN32 := $(CSRCFILES:%.c=$(OBJDIR_WIN32)/%.o) + CCOPT = -march=i586 -O6 -ffast-math -funroll-loops \ -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \ - -malign-jumps=2 -malign-functions=2 -s -DNDEBUG + -malign-jumps=2 -malign-functions=2 -s -DNDEBUG -lstdc++ -INCLUDEDIRS=-I../curl/include -I$(SRCDIR) -I$(AMXDIR) -I$(METADIR) -I$(SDKSRC)/engine -I$(SDKSRC)/common -I$(SDKSRC)/pm_shared -I$(SDKSRC)/dlls -I$(SDKSRC) $(EXTRA_INCLUDEDIRS) +INCLUDEDIRS=-I../curl/include -I$(SRCDIR) -I$(METADIR) -I$(SDKSRC)/engine -I$(SDKSRC)/common -I$(SDKSRC)/pm_shared -I$(SDKSRC)/dlls -I$(SDKSRC) $(EXTRA_INCLUDEDIRS) CFLAGS=-Wall -Wno-unknown-pragmas ODEF = -DOPT_TYPE=\"optimized\" CFLAGS:=$(CCOPT) $(CFLAGS) $(ODEF) $(EXTRA_FLAGS) DO_CC_LINUX=$(CC_LINUX) $(CFLAGS) -fPIC $(INCLUDEDIRS) -o $@ -c $< DO_CC_WIN32=$(CC_WIN32) $(CFLAGS) $(INCLUDEDIRS) -o $@ -c $< -LINK_LINUX=$(CC_LINUX) $(CFLAGS) -shared -ldl -lm $(OBJ_LINUX) $(EXTRA_LIBDIRS_LINUX) $(EXTRA_LIBS_LINUX) -o $@ -LINK_WIN32=$(LD_WINDLL) -mwindows --def $(MODNAME).def --add-stdcall-alias $(OBJ_WIN32) $(EXTRA_LIBDIRS_WIN32) $(EXTRA_LIBS_WIN32) -o $@ +LINK_LINUX=$(CC_LINUX) $(CFLAGS) -shared -ldl -lm $(OBJ_LINUX) $(OBJC_LINUX) $(EXTRA_LIBDIRS_LINUX) $(EXTRA_LIBS_LINUX) -o $@ +LINK_WIN32=$(LD_WINDLL) -mwindows --def $(MODNAME).def --add-stdcall-alias $(OBJ_WIN32) $(OBJC_WIN32) $(EXTRA_LIBDIRS_WIN32) $(EXTRA_LIBS_WIN32) -o $@ + +$(OBJDIR_LINUX)/%.o: $(SRCDIR)/%.c + $(DO_CC_LINUX) $(OBJDIR_LINUX)/%.o: $(SRCDIR)/%.cpp $(DO_CC_LINUX) +$(OBJDIR_WIN32)/%.o: $(SRCDIR)/%.c + $(DO_CC_WIN32) + $(OBJDIR_WIN32)/%.o: $(SRCDIR)/%.cpp $(DO_CC_WIN32) default: $(DEFAULT) -$(TARGET_LINUX): $(OBJDIR_LINUX) $(OBJ_LINUX) +$(TARGET_LINUX): $(OBJDIR_LINUX) $(OBJ_LINUX) $(OBJC_LINUX) $(LINK_LINUX) -$(TARGET_WIN32): $(OBJDIR_WIN32) $(OBJ_WIN32) +$(TARGET_WIN32): $(OBJDIR_WIN32) $(OBJ_WIN32) $(OBJC_WIN32) $(LINK_WIN32) $(OBJDIR_LINUX): diff --git a/dlls/cstrike/cstrike.cpp b/dlls/cstrike/cstrike.cpp index 0372dbe1..23c9a229 100755 --- a/dlls/cstrike/cstrike.cpp +++ b/dlls/cstrike/cstrike.cpp @@ -4,7 +4,7 @@ * Counter-Strike Module * * by the AMX Mod X Development Team - * + * * This file is part of AMX Mod X. * * @@ -1315,7 +1315,11 @@ C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason) { } } +#ifdef LINUX +C_DLLEXPORT void GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) { +#else void WINAPI GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) { +#endif memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t)); gpGlobals = pGlobals; }