7 /***********************************************************
8 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
13 Permission to use, copy, modify, and distribute this software and its
14 documentation for any purpose and without fee is hereby granted,
15 provided that the above copyright notice appear in all copies and that
16 both that copyright notice and this permission notice appear in
17 supporting documentation, and that the names of Stichting Mathematisch
18 Centrum or CWI or Corporation for National Research Initiatives or
19 CNRI not be used in advertising or publicity pertaining to
20 distribution of the software without specific, written prior
23 While CWI is the initial source for this software, a modified version
24 is made available by the Corporation for National Research Initiatives
25 (CNRI) at the Internet address ftp://ftp.python.org.
27 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
28 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
29 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
30 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
31 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
32 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
33 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
34 PERFORMANCE OF THIS SOFTWARE.
36 ******************************************************************/
38 /* C objects to be exported from one extension module to another.
40 C objects are used for communication between extension modules.
41 They provide a way for an extension module to export a C interface
42 to other extension modules, so that extension modules can use the
43 Python import mechanism to link to one another.
47 extern DL_IMPORT(PyTypeObject
) PyCObject_Type
;
49 #define PyCObject_Check(op) ((op)->ob_type == &PyCObject_Type)
51 /* Create a PyCObject from a pointer to a C object and an optional
52 destrutor function. If the second argument is non-null, then it
53 will be called with the first argument if and when the PyCObject is
57 extern DL_IMPORT(PyObject
*)
58 PyCObject_FromVoidPtr
Py_PROTO((void *cobj
, void (*destruct
)(void*)));
61 /* Create a PyCObject from a pointer to a C object, a description object,
62 and an optional destrutor function. If the third argument is non-null,
63 then it will be called with the first and second arguments if and when
64 the PyCObject is destroyed.
66 extern DL_IMPORT(PyObject
*)
67 PyCObject_FromVoidPtrAndDesc
Py_PROTO((void *cobj
, void *desc
,
68 void (*destruct
)(void*,void*)));
70 /* Retrieve a pointer to a C object from a PyCObject. */
71 extern DL_IMPORT(void *)
72 PyCObject_AsVoidPtr
Py_PROTO((PyObject
*));
74 /* Retrieve a pointer to a description object from a PyCObject. */
75 extern DL_IMPORT(void *)
76 PyCObject_GetDesc
Py_PROTO((PyObject
*));
78 /* Import a pointer to a C object from a module using a PyCObject. */
79 extern DL_IMPORT(void *)
80 PyCObject_Import
Py_PROTO((char *module_name
, char *cobject_name
));
85 #endif /* !Py_COBJECT_H */