changes for C++ (Tim MacKenzie)

This commit is contained in:
Guido van Rossum 1995-01-10 17:43:33 +00:00
parent 062cfb0c4e
commit 6c1874fc2b
3 changed files with 33 additions and 7 deletions

View File

@ -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));

View File

@ -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

View File

@ -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