File: cmodule.c

package info (click to toggle)
pycairo 1.27.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,984 kB
  • sloc: ansic: 8,873; python: 3,688; makefile: 32; sh: 4
file content (37 lines) | stat: -rw-r--r-- 690 bytes parent folder | download
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
#include <Python.h>
#include <py3cairo.h>
#include "cmodulelib.h"

static PyMethodDef CModMethods[] = {
    {"create_image_surface", create_image_surface, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

#ifdef __GNUC__
#define PYCAIRO_MODINIT_FUNC __attribute__((visibility("default"))) PyMODINIT_FUNC
#else
#define PYCAIRO_MODINIT_FUNC PyMODINIT_FUNC
#endif

static struct PyModuleDef cmod_module = {
    PyModuleDef_HEAD_INIT,
    "cmod",
    NULL,
    -1,
    CModMethods,
};

PYCAIRO_MODINIT_FUNC
PyInit_cmod (void)
{
    PyObject *m;

    if (import_cairo () < 0)
        return NULL;

    m = PyModule_Create (&cmod_module);
    if (m == NULL)
        return NULL;

    return m;
}