blob: 86dbb0e648e2e24fa6cf95f57c2837a758062e3a [file] [log] [blame]
Guido van Rossuma3309961993-07-28 09:05:47 +00001#ifndef Py_MODSUPPORT_H
2#define Py_MODSUPPORT_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
Guido van Rossumf70e43a1991-02-19 12:39:46 +00007/***********************************************************
Guido van Rossumfd71b9e2000-06-30 23:50:40 +00008Copyright (c) 2000, BeOpen.com.
9Copyright (c) 1995-2000, Corporation for National Research Initiatives.
10Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
11All rights reserved.
Guido van Rossumf70e43a1991-02-19 12:39:46 +000012
Guido van Rossumfd71b9e2000-06-30 23:50:40 +000013See the file "Misc/COPYRIGHT" for information on usage and
14redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
Guido van Rossumf70e43a1991-02-19 12:39:46 +000015******************************************************************/
16
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000017/* Module support interface */
18
Guido van Rossumb6775db1994-08-01 11:34:53 +000019#ifdef HAVE_STDARG_PROTOTYPES
20
21#include <stdarg.h>
22
Guido van Rossum43466ec1998-12-04 18:48:25 +000023extern DL_IMPORT(int) PyArg_Parse Py_PROTO((PyObject *, char *, ...));
24extern DL_IMPORT(int) PyArg_ParseTuple Py_PROTO((PyObject *, char *, ...));
25extern DL_IMPORT(int) PyArg_ParseTupleAndKeywords Py_PROTO((PyObject *, PyObject *,
Guido van Rossum36280a71997-02-14 16:36:35 +000026 char *, char **, ...));
Guido van Rossum43466ec1998-12-04 18:48:25 +000027extern DL_IMPORT(PyObject *) Py_BuildValue Py_PROTO((char *, ...));
Guido van Rossumb6775db1994-08-01 11:34:53 +000028
29#else
30
31#include <varargs.h>
32
33/* Better to have no prototypes at all for varargs functions in this case */
Guido van Rossum43466ec1998-12-04 18:48:25 +000034extern DL_IMPORT(int) PyArg_Parse();
35extern DL_IMPORT(int) PyArg_ParseTuple();
36extern DL_IMPORT(PyObject *) Py_BuildValue();
Guido van Rossumb6775db1994-08-01 11:34:53 +000037
Guido van Rossume5372401993-03-16 12:15:04 +000038#endif
39
Guido van Rossum43466ec1998-12-04 18:48:25 +000040extern DL_IMPORT(int) PyArg_VaParse Py_PROTO((PyObject *, char *, va_list));
41extern DL_IMPORT(PyObject *) Py_VaBuildValue Py_PROTO((char *, va_list));
Guido van Rossume5372401993-03-16 12:15:04 +000042
Guido van Rossum21a50bd2000-03-29 01:46:45 +000043#define PYTHON_API_VERSION 1009
44#define PYTHON_API_STRING "1009"
Guido van Rossum970a0a21995-01-09 17:47:20 +000045/* The API version is maintained (independently from the Python version)
46 so we can detect mismatches between the interpreter and dynamically
Guido van Rossumae8a99e1996-07-30 16:41:02 +000047 loaded modules. These are diagnosticised by an error message but
48 the module is still loaded (because the mismatch can only be tested
49 after loading the module). The error message is intended to
50 explain the core dump a few seconds later.
Guido van Rossum970a0a21995-01-09 17:47:20 +000051
Guido van Rossum2ea0b061996-08-22 22:55:47 +000052 The symbol PYTHON_API_STRING defines the same value as a string
53 literal. *** PLEASE MAKE SURE THE DEFINITIONS MATCH. ***
54
Guido van Rossum970a0a21995-01-09 17:47:20 +000055 Please add a line or two to the top of this log for each API
56 version change:
57
Guido van Rossum21a50bd2000-03-29 01:46:45 +000058 14-Mar-2000 GvR 1009 Unicode API added
59
Guido van Rossumf1176c41999-01-03 12:40:24 +000060 3-Jan-1999 GvR 1007 Decided to change back! (Don't reuse 1008!)
61
62 3-Dec-1998 GvR 1008 Python 1.5.2b1
Guido van Rossum7531d501998-12-03 18:18:12 +000063
64 18-Jan-1997 GvR 1007 string interning and other speedups
Guido van Rossumee5cf9b1997-01-18 07:54:03 +000065
Guido van Rossume449af71996-10-11 16:25:41 +000066 11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-(
67
Guido van Rossumae8a99e1996-07-30 16:41:02 +000068 30-Jul-1996 GvR Slice and ellipses syntax added
69
70 23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-)
71
Guido van Rossume0dbd591996-01-12 00:49:39 +000072 7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( )
73
Guido van Rossumcaa63801995-01-12 11:45:45 +000074 10-Jan-1995 GvR Renamed globals to new naming scheme
75
Guido van Rossum970a0a21995-01-09 17:47:20 +000076 9-Jan-1995 GvR Initial version (incompatible with older API)
77*/
78
Guido van Rossum2ea0b061996-08-22 22:55:47 +000079#ifdef MS_WINDOWS
Guido van Rossumb4cfdfa1997-09-29 23:29:08 +000080/* Special defines for Windows versions used to live here. Things
81 have changed, and the "Version" is now in a global string variable.
82 Reason for this is that this for easier branding of a "custom DLL"
83 without actually needing a recompile. */
Guido van Rossum2ea0b061996-08-22 22:55:47 +000084#endif /* MS_WINDOWS */
85
86#ifdef Py_TRACE_REFS
87/* When we are tracing reference counts, rename Py_InitModule4 so
88 modules compiled with incompatible settings will generate a
89 link-time error. */
90#define Py_InitModule4 Py_InitModule4TraceRefs
91#endif
92
Guido van Rossum43466ec1998-12-04 18:48:25 +000093extern DL_IMPORT(PyObject *) Py_InitModule4 Py_PROTO((char *, PyMethodDef *,
Guido van Rossumcaa63801995-01-12 11:45:45 +000094 char *, PyObject *, int));
95#define Py_InitModule(name, methods) \
96 Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
97 PYTHON_API_VERSION)
Guido van Rossuma3309961993-07-28 09:05:47 +000098
Guido van Rossuma70d1601998-06-27 18:21:59 +000099#define Py_InitModule3(name, methods, doc) \
100 Py_InitModule4(name, methods, doc, (PyObject *)NULL, \
101 PYTHON_API_VERSION)
102
Guido van Rossum43466ec1998-12-04 18:48:25 +0000103extern DL_IMPORT(char *) _Py_PackageContext;
Guido van Rossumee6fd1c1997-11-19 18:51:35 +0000104
Guido van Rossuma3309961993-07-28 09:05:47 +0000105#ifdef __cplusplus
106}
107#endif
108#endif /* !Py_MODSUPPORT_H */