A directory with a working example of how to build an extension.

This commit is contained in:
Guido van Rossum 1996-09-06 21:16:21 +00:00
parent 5c1d1ee8a8
commit 026f01a297
4 changed files with 417 additions and 0 deletions

21
PC/example_nt/example.c Normal file
View file

@ -0,0 +1,21 @@
#include "Python.h"
static PyObject *
ex_foo(self, args)
PyObject *self, *args;
{
printf("Hello, world\n");
Py_INCREF(Py_None);
return Py_None;
}
static PyMethodDef example_methods[] = {
{"foo", ex_foo, 1, "foo() doc string"},
{NULL, NULL}
};
void
initexample()
{
Py_InitModule("example", example_methods);
}