diff options
author | Guido van Rossum <guido@python.org> | 1995-01-10 17:43:33 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-01-10 17:43:33 +0000 |
commit | 6c1874fc2bd0e0d2e30de78fe1f1fe8bcf8a20be (patch) | |
tree | 272cf71937fdd8612162ce179786467c44ec3c70 | |
parent | added interface to Tk_DoOneEvent (R Lindsay Todd) (diff) | |
download | cpython-6c1874fc2bd0e0d2e30de78fe1f1fe8bcf8a20be.tar.gz cpython-6c1874fc2bd0e0d2e30de78fe1f1fe8bcf8a20be.tar.bz2 cpython-6c1874fc2bd0e0d2e30de78fe1f1fe8bcf8a20be.zip |
changes for C++ (Tim MacKenzie)
-rw-r--r-- | Include/mymalloc.h | 14 | ||||
-rw-r--r-- | Modules/Makefile.pre.in | 5 | ||||
-rw-r--r-- | Modules/config.c.in | 21 |
3 files changed, 33 insertions, 7 deletions
diff --git a/Include/mymalloc.h b/Include/mymalloc.h index 877bcb98971..3c80db10f62 100644 --- a/Include/mymalloc.h +++ b/Include/mymalloc.h @@ -1,9 +1,5 @@ #ifndef Py_MYMALLOC_H #define Py_MYMALLOC_H -#ifdef __cplusplus -extern "C" { -#endif - /*********************************************************** Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, The Netherlands. @@ -52,7 +48,15 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifdef HAVE_STDLIB_H #include <stdlib.h> -#else /* !HAVE_STDLIB */ +#endif + +#ifdef __cplusplus +// Move this down here since some C++ #include's don't like to be included +// inside an extern "C" +extern "C" { +#endif + +#ifndef HAVE_STDLIB_H extern ANY *malloc PROTO((size_t)); extern ANY *calloc PROTO((size_t, size_t)); extern ANY *realloc PROTO((ANY *, size_t)); diff --git a/Modules/Makefile.pre.in b/Modules/Makefile.pre.in index 5662ea5aa62..8ebf62a03d1 100644 --- a/Modules/Makefile.pre.in +++ b/Modules/Makefile.pre.in @@ -6,6 +6,7 @@ # brought up to date by running "make Makefile". (The makesetup also # creates config.c from config.c.in in the source directory.) +LINKCC = $(CC) # === Variables set by makesetup === MODOBJS= _MODOBJS_ @@ -79,12 +80,12 @@ $(LIB): $(OBJS) Makefile $(RANLIB) $(LIB) ../python: config.o $(MYLIBS) Makefile - $(CC) $(OPT) config.o $(LINKFORSHARED) \ + $(LINKCC) $(OPT) config.o $(LINKFORSHARED) \ $(MYLIBS) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python mv python ../python config.o: config.c Makefile $(MYLIBS) - $(CC) $(CFLAGS) -DPYTHONPATH=\"$(PYTHONPATH)\" -c config.c + $(LINKCC) $(CFLAGS) -DPYTHONPATH=\"$(PYTHONPATH)\" -c config.c clean: -rm -f *.o python core *~ [@,#]* *.old *.orig *.rej diff --git a/Modules/config.c.in b/Modules/config.c.in index ba8b9d78a5e..0c2f114489d 100644 --- a/Modules/config.c.in +++ b/Modules/config.c.in @@ -41,6 +41,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "osdefs.h" #include "intrcheck.h" +#if defined(__cplusplus) +extern "C" { +#endif #ifndef NO_MAIN @@ -59,9 +62,14 @@ static char *argv0; static char **orig_argv; static int orig_argc; +#if defined(__cplusplus) +int realmain(int, char**); +main(int argc, char **argv) +#else main(argc, argv) int argc; char **argv; +#endif { orig_argc = argc; orig_argv = argv; @@ -76,9 +84,13 @@ getprogramname() } void +#if defined(__cplusplus) +getargcargv(int *argc, char ***argv) +#else getargcargv(argc,argv) int *argc; char ***argv; +#endif { *argc = orig_argc; *argv = orig_argv; @@ -144,11 +156,16 @@ getcopyright() #define PYTHONPATH ".:/usr/local/lib/python" #endif /* !PYTHONPATH */ +#ifndef __cplusplus extern char *getenv(); +#endif char * getpythonpath() { +#ifdef __cplusplus + void fatal(char *); +#endif char *path = getenv("PYTHONPATH"); char *defpath = PYTHONPATH; static char *buf = NULL; @@ -215,3 +232,7 @@ struct frozen { {0, 0, 0} }; #endif + +#if defined(__cplusplus) +} +#endif |