~ubuntu-branches/ubuntu/maverick/python3.1/maverick

« back to all changes in this revision

Viewing changes to PC/example_nt/example.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-03-23 00:01:27 UTC
  • Revision ID: james.westby@ubuntu.com-20090323000127-5fstfxju4ufrhthq
Tags: upstream-3.1~a1+20090322
ImportĀ upstreamĀ versionĀ 3.1~a1+20090322

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "Python.h"
 
2
 
 
3
static PyObject *
 
4
ex_foo(PyObject *self, PyObject *args)
 
5
{
 
6
        printf("Hello, world\n");
 
7
        Py_INCREF(Py_None);
 
8
        return Py_None;
 
9
}
 
10
 
 
11
static PyMethodDef example_methods[] = {
 
12
        {"foo", ex_foo, METH_VARARGS, "foo() doc string"},
 
13
        {NULL, NULL}
 
14
};
 
15
 
 
16
static struct PyModuleDef examplemodule = {
 
17
        PyModuleDef_HEAD_INIT,
 
18
        "example",
 
19
        "example module doc string",
 
20
        -1,
 
21
        example_methods,
 
22
        NULL,
 
23
        NULL,
 
24
        NULL,
 
25
        NULL
 
26
};
 
27
 
 
28
PyMODINIT_FUNC
 
29
PyInit_example(void)
 
30
{
 
31
        return PyModule_Create(&examplemodule);
 
32
}