- Notifications
You must be signed in to change notification settings - Fork 31.7k
/
Copy pathpycapsule.h
56 lines (36 loc) · 1.64 KB
/
pycapsule.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* Capsule objects let you wrap a C "void *" pointer in a Python
object. They're a way of passing data through the Python interpreter
without creating your own custom type.
Capsules are used for communication between extension modules.
They provide a way for an extension module to export a C interface
to other extension modules, so that extension modules can use the
Python import mechanism to link to one another.
For more information, please see "c-api/capsule.html" in the
documentation.
*/
#ifndefPy_CAPSULE_H
#definePy_CAPSULE_H
#ifdef__cplusplus
extern"C" {
#endif
PyAPI_DATA(PyTypeObject) PyCapsule_Type;
typedefvoid (*PyCapsule_Destructor)(PyObject*);
#definePyCapsule_CheckExact(op) (Py_TYPE(op) == &PyCapsule_Type)
PyAPI_FUNC(PyObject*) PyCapsule_New(
void*pointer,
constchar*name,
PyCapsule_Destructordestructor);
PyAPI_FUNC(void*) PyCapsule_GetPointer(PyObject*capsule, constchar*name);
PyAPI_FUNC(PyCapsule_Destructor) PyCapsule_GetDestructor(PyObject*capsule);
PyAPI_FUNC(constchar*) PyCapsule_GetName(PyObject*capsule);
PyAPI_FUNC(void*) PyCapsule_GetContext(PyObject*capsule);
PyAPI_FUNC(int) PyCapsule_IsValid(PyObject*capsule, constchar*name);
PyAPI_FUNC(int) PyCapsule_SetPointer(PyObject*capsule, void*pointer);
PyAPI_FUNC(int) PyCapsule_SetDestructor(PyObject*capsule, PyCapsule_Destructordestructor);
PyAPI_FUNC(int) PyCapsule_SetName(PyObject*capsule, constchar*name);
PyAPI_FUNC(int) PyCapsule_SetContext(PyObject*capsule, void*context);
PyAPI_FUNC(void*) PyCapsule_Import(constchar*name, intno_block);
#ifdef__cplusplus
}
#endif
#endif/* !Py_CAPSULE_H */