blob: 4a40499eb564ff34d1f3ec5d9c739d31acf38b3a [file] [log] [blame]
Guido van Rossumf70e43a1991-02-19 12:39:46 +00001
Fred Draked5c84ed2000-07-08 17:25:55 +00002#ifndef Py_MODSUPPORT_H
3#define Py_MODSUPPORT_H
4#ifdef __cplusplus
5extern "C" {
6#endif
7
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00008/* Module support interface */
9
Guido van Rossumb6775db1994-08-01 11:34:53 +000010#include <stdarg.h>
11
Fred Draked5c84ed2000-07-08 17:25:55 +000012extern DL_IMPORT(int) PyArg_Parse(PyObject *, char *, ...);
13extern DL_IMPORT(int) PyArg_ParseTuple(PyObject *, char *, ...);
14extern DL_IMPORT(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
15 char *, char **, ...);
16extern DL_IMPORT(PyObject *) Py_BuildValue(char *, ...);
Guido van Rossumb6775db1994-08-01 11:34:53 +000017
Fred Draked5c84ed2000-07-08 17:25:55 +000018extern DL_IMPORT(int) PyArg_VaParse(PyObject *, char *, va_list);
19extern DL_IMPORT(PyObject *) Py_VaBuildValue(char *, va_list);
Guido van Rossume5372401993-03-16 12:15:04 +000020
Fred Drake9e285152000-09-23 03:24:27 +000021extern DL_IMPORT(int) PyModule_AddObject(PyObject *, char *, PyObject *);
22extern DL_IMPORT(int) PyModule_AddIntConstant(PyObject *, char *, long);
23extern DL_IMPORT(int) PyModule_AddStringConstant(PyObject *, char *, char *);
24
Fred Drake73a3c8f2001-01-25 22:13:34 +000025#define PYTHON_API_VERSION 1010
26#define PYTHON_API_STRING "1010"
Guido van Rossum970a0a21995-01-09 17:47:20 +000027/* The API version is maintained (independently from the Python version)
28 so we can detect mismatches between the interpreter and dynamically
Thomas Wouters7e474022000-07-16 12:04:32 +000029 loaded modules. These are diagnosed by an error message but
Guido van Rossumae8a99e1996-07-30 16:41:02 +000030 the module is still loaded (because the mismatch can only be tested
31 after loading the module). The error message is intended to
32 explain the core dump a few seconds later.
Guido van Rossum970a0a21995-01-09 17:47:20 +000033
Guido van Rossum2ea0b061996-08-22 22:55:47 +000034 The symbol PYTHON_API_STRING defines the same value as a string
35 literal. *** PLEASE MAKE SURE THE DEFINITIONS MATCH. ***
36
Guido van Rossum970a0a21995-01-09 17:47:20 +000037 Please add a line or two to the top of this log for each API
38 version change:
39
Fred Drake73a3c8f2001-01-25 22:13:34 +000040 25-Jan-2001 FLD 1010 Parameters added to PyCode_New() and
41 PyFrame_New(); Python 2.1a2
42
Guido van Rossum21a50bd2000-03-29 01:46:45 +000043 14-Mar-2000 GvR 1009 Unicode API added
44
Guido van Rossumf1176c41999-01-03 12:40:24 +000045 3-Jan-1999 GvR 1007 Decided to change back! (Don't reuse 1008!)
46
47 3-Dec-1998 GvR 1008 Python 1.5.2b1
Guido van Rossum7531d501998-12-03 18:18:12 +000048
49 18-Jan-1997 GvR 1007 string interning and other speedups
Guido van Rossumee5cf9b1997-01-18 07:54:03 +000050
Guido van Rossume449af71996-10-11 16:25:41 +000051 11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-(
52
Guido van Rossumae8a99e1996-07-30 16:41:02 +000053 30-Jul-1996 GvR Slice and ellipses syntax added
54
55 23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-)
56
Guido van Rossume0dbd591996-01-12 00:49:39 +000057 7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( )
58
Guido van Rossumcaa63801995-01-12 11:45:45 +000059 10-Jan-1995 GvR Renamed globals to new naming scheme
60
Guido van Rossum970a0a21995-01-09 17:47:20 +000061 9-Jan-1995 GvR Initial version (incompatible with older API)
62*/
63
Guido van Rossum2ea0b061996-08-22 22:55:47 +000064#ifdef MS_WINDOWS
Guido van Rossumb4cfdfa1997-09-29 23:29:08 +000065/* Special defines for Windows versions used to live here. Things
66 have changed, and the "Version" is now in a global string variable.
67 Reason for this is that this for easier branding of a "custom DLL"
68 without actually needing a recompile. */
Guido van Rossum2ea0b061996-08-22 22:55:47 +000069#endif /* MS_WINDOWS */
70
71#ifdef Py_TRACE_REFS
72/* When we are tracing reference counts, rename Py_InitModule4 so
73 modules compiled with incompatible settings will generate a
74 link-time error. */
75#define Py_InitModule4 Py_InitModule4TraceRefs
76#endif
77
Fred Draked5c84ed2000-07-08 17:25:55 +000078extern DL_IMPORT(PyObject *) Py_InitModule4(char *name, PyMethodDef *methods,
79 char *doc, PyObject *self,
80 int apiver);
81
Guido van Rossumcaa63801995-01-12 11:45:45 +000082#define Py_InitModule(name, methods) \
83 Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
84 PYTHON_API_VERSION)
Guido van Rossuma3309961993-07-28 09:05:47 +000085
Guido van Rossuma70d1601998-06-27 18:21:59 +000086#define Py_InitModule3(name, methods, doc) \
87 Py_InitModule4(name, methods, doc, (PyObject *)NULL, \
88 PYTHON_API_VERSION)
89
Guido van Rossum43466ec1998-12-04 18:48:25 +000090extern DL_IMPORT(char *) _Py_PackageContext;
Guido van Rossumee6fd1c1997-11-19 18:51:35 +000091
Guido van Rossuma3309961993-07-28 09:05:47 +000092#ifdef __cplusplus
93}
94#endif
95#endif /* !Py_MODSUPPORT_H */