blob: 54c7addf4142ee5fddf282c84654fafa89f6fc4b [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
Guido van Rossum21a50bd2000-03-29 01:46:45 +000025#define PYTHON_API_VERSION 1009
26#define PYTHON_API_STRING "1009"
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
Guido van Rossum21a50bd2000-03-29 01:46:45 +000040 14-Mar-2000 GvR 1009 Unicode API added
41
Guido van Rossumf1176c41999-01-03 12:40:24 +000042 3-Jan-1999 GvR 1007 Decided to change back! (Don't reuse 1008!)
43
44 3-Dec-1998 GvR 1008 Python 1.5.2b1
Guido van Rossum7531d501998-12-03 18:18:12 +000045
46 18-Jan-1997 GvR 1007 string interning and other speedups
Guido van Rossumee5cf9b1997-01-18 07:54:03 +000047
Guido van Rossume449af71996-10-11 16:25:41 +000048 11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-(
49
Guido van Rossumae8a99e1996-07-30 16:41:02 +000050 30-Jul-1996 GvR Slice and ellipses syntax added
51
52 23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-)
53
Guido van Rossume0dbd591996-01-12 00:49:39 +000054 7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( )
55
Guido van Rossumcaa63801995-01-12 11:45:45 +000056 10-Jan-1995 GvR Renamed globals to new naming scheme
57
Guido van Rossum970a0a21995-01-09 17:47:20 +000058 9-Jan-1995 GvR Initial version (incompatible with older API)
59*/
60
Guido van Rossum2ea0b061996-08-22 22:55:47 +000061#ifdef MS_WINDOWS
Guido van Rossumb4cfdfa1997-09-29 23:29:08 +000062/* Special defines for Windows versions used to live here. Things
63 have changed, and the "Version" is now in a global string variable.
64 Reason for this is that this for easier branding of a "custom DLL"
65 without actually needing a recompile. */
Guido van Rossum2ea0b061996-08-22 22:55:47 +000066#endif /* MS_WINDOWS */
67
68#ifdef Py_TRACE_REFS
69/* When we are tracing reference counts, rename Py_InitModule4 so
70 modules compiled with incompatible settings will generate a
71 link-time error. */
72#define Py_InitModule4 Py_InitModule4TraceRefs
73#endif
74
Fred Draked5c84ed2000-07-08 17:25:55 +000075extern DL_IMPORT(PyObject *) Py_InitModule4(char *name, PyMethodDef *methods,
76 char *doc, PyObject *self,
77 int apiver);
78
Guido van Rossumcaa63801995-01-12 11:45:45 +000079#define Py_InitModule(name, methods) \
80 Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
81 PYTHON_API_VERSION)
Guido van Rossuma3309961993-07-28 09:05:47 +000082
Guido van Rossuma70d1601998-06-27 18:21:59 +000083#define Py_InitModule3(name, methods, doc) \
84 Py_InitModule4(name, methods, doc, (PyObject *)NULL, \
85 PYTHON_API_VERSION)
86
Guido van Rossum43466ec1998-12-04 18:48:25 +000087extern DL_IMPORT(char *) _Py_PackageContext;
Guido van Rossumee6fd1c1997-11-19 18:51:35 +000088
Guido van Rossuma3309961993-07-28 09:05:47 +000089#ifdef __cplusplus
90}
91#endif
92#endif /* !Py_MODSUPPORT_H */