Chris@87: Chris@87: /* Capsule objects let you wrap a C "void *" pointer in a Python Chris@87: object. They're a way of passing data through the Python interpreter Chris@87: without creating your own custom type. Chris@87: Chris@87: Capsules are used for communication between extension modules. Chris@87: They provide a way for an extension module to export a C interface Chris@87: to other extension modules, so that extension modules can use the Chris@87: Python import mechanism to link to one another. Chris@87: Chris@87: For more information, please see "c-api/capsule.html" in the Chris@87: documentation. Chris@87: */ Chris@87: Chris@87: #ifndef Py_CAPSULE_H Chris@87: #define Py_CAPSULE_H Chris@87: #ifdef __cplusplus Chris@87: extern "C" { Chris@87: #endif Chris@87: Chris@87: PyAPI_DATA(PyTypeObject) PyCapsule_Type; Chris@87: Chris@87: typedef void (*PyCapsule_Destructor)(PyObject *); Chris@87: Chris@87: #define PyCapsule_CheckExact(op) (Py_TYPE(op) == &PyCapsule_Type) Chris@87: Chris@87: Chris@87: PyAPI_FUNC(PyObject *) PyCapsule_New( Chris@87: void *pointer, Chris@87: const char *name, Chris@87: PyCapsule_Destructor destructor); Chris@87: Chris@87: PyAPI_FUNC(void *) PyCapsule_GetPointer(PyObject *capsule, const char *name); Chris@87: Chris@87: PyAPI_FUNC(PyCapsule_Destructor) PyCapsule_GetDestructor(PyObject *capsule); Chris@87: Chris@87: PyAPI_FUNC(const char *) PyCapsule_GetName(PyObject *capsule); Chris@87: Chris@87: PyAPI_FUNC(void *) PyCapsule_GetContext(PyObject *capsule); Chris@87: Chris@87: PyAPI_FUNC(int) PyCapsule_IsValid(PyObject *capsule, const char *name); Chris@87: Chris@87: PyAPI_FUNC(int) PyCapsule_SetPointer(PyObject *capsule, void *pointer); Chris@87: Chris@87: PyAPI_FUNC(int) PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor); Chris@87: Chris@87: PyAPI_FUNC(int) PyCapsule_SetName(PyObject *capsule, const char *name); Chris@87: Chris@87: PyAPI_FUNC(int) PyCapsule_SetContext(PyObject *capsule, void *context); Chris@87: Chris@87: PyAPI_FUNC(void *) PyCapsule_Import(const char *name, int no_block); Chris@87: Chris@87: #ifdef __cplusplus Chris@87: } Chris@87: #endif Chris@87: #endif /* !Py_CAPSULE_H */