From 96c9fc8bc8fbecb005d0e0941f9603836176629e Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 2 Aug 2005 19:05:51 +0000 Subject: [PATCH] Changes for linux compatibility --- compiler/amxxpc/amxxpc.cpp | 8 ++++---- compiler/libpc300/Makefile | 3 +++ compiler/libpc300/sc.h | 6 +++++- compiler/libpc300/sc1.c | 2 ++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/compiler/amxxpc/amxxpc.cpp b/compiler/amxxpc/amxxpc.cpp index e405893c..63a623eb 100755 --- a/compiler/amxxpc/amxxpc.cpp +++ b/compiler/amxxpc/amxxpc.cpp @@ -99,6 +99,7 @@ int main(int argc, char **argv) fclose(fp); } + dlclose(lib); unlink(file); HINSTANCE lib64 = 0; @@ -107,7 +108,8 @@ int main(int argc, char **argv) #else lib64 = dlmount("amxxpc64.dll"); #endif - if (!lib64) + pc_printf = (PRINTF)dlsym(lib64, "pc_printf"); + if (!lib64 || !pc_printf) { pc_printf("64bit compiler failed to instantiate.\n"); exit(0); @@ -127,8 +129,6 @@ int main(int argc, char **argv) sc64(argc, argv); - dlclose(lib64); - if (file == NULL) { pc_printf("Could not locate the output file on second pass.\n"); @@ -207,7 +207,7 @@ int main(int argc, char **argv) pc_printf("Done.\n"); - dlclose(lib); + dlclose(lib64); exit(0); } diff --git a/compiler/libpc300/Makefile b/compiler/libpc300/Makefile index 7f4a0254..36bf05bb 100755 --- a/compiler/libpc300/Makefile +++ b/compiler/libpc300/Makefile @@ -42,6 +42,9 @@ all: pawn_make: $(OBJ_LINUX) $(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY) +pawn64: + $(MAKE) pawn_make PAWN64=true + debug: $(MAKE) all DEBUG=true diff --git a/compiler/libpc300/sc.h b/compiler/libpc300/sc.h index 7051de4a..88a9dfc4 100755 --- a/compiler/libpc300/sc.h +++ b/compiler/libpc300/sc.h @@ -629,7 +629,11 @@ SC_FUNC void jmp_eq0(int number); SC_FUNC void outval(cell val,int newline); /* function prototypes in SC5.C */ -SC_FUNC int error(int number,...); +#ifdef __linux__ +SC_FUNC int error(int number,...) __attribute__((visibility("internal"))); +#else +SC_FUNC int error(int number,...) +#endif SC_FUNC void errorset(int code); /* function prototypes in SC6.C */ diff --git a/compiler/libpc300/sc1.c b/compiler/libpc300/sc1.c index eca78785..82889cb1 100755 --- a/compiler/libpc300/sc1.c +++ b/compiler/libpc300/sc1.c @@ -654,6 +654,7 @@ cleanup: int flag_exceed=0; if (sc_amxlimit > 0 && (long)(hdrsize+code_idx+glb_declared*sizeof(cell)+sc_stksize*sizeof(cell)) >= sc_amxlimit) flag_exceed=1; +#if PAWN_CELL_SIZE==32 if ((sc_debug & sSYMBOLIC)!=0 || verbosity>=2 || stacksize+32>=(long)sc_stksize || flag_exceed) { pc_printf("Header size: %8ld bytes\n", (long)hdrsize); pc_printf("Code size: %8ld bytes\n", (long)code_idx); @@ -665,6 +666,7 @@ cleanup: pc_printf("estimated max. usage=%ld cells (%ld bytes)\n",stacksize,stacksize*sizeof(cell)); pc_printf("Total requirements:%8ld bytes\n", (long)hdrsize+(long)code_idx+(long)glb_declared*sizeof(cell)+(long)sc_stksize*sizeof(cell)); } /* if */ +#endif if (flag_exceed) error(106,sc_amxlimit); /* this causes a jump back to label "cleanup" */ } /* if */