forked from Yetiowner/Increasing-code-complexity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhello.c
33 lines (27 loc) · 743 Bytes
/
hello.c
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
#include <Python.h>
#include <stdio.h>
static PyObject* c_helloworld(PyObject* self, PyObject* args)
{
char *strtoprint;
PyArg_ParseTuple(args, "s", &strtoprint);
printf("%s", strtoprint);
printf("\n");
return Py_BuildValue("i", 1);
}
static char c_helloworld_docs[] =
"c_helloworld( ): Lol you think we write documentation?\n";
static PyMethodDef myMethods[] = {
{ "c_helloworld", (PyCFunction)c_helloworld, METH_VARARGS, c_helloworld_docs },
{NULL}
};
static struct PyModuleDef myModule = {
PyModuleDef_HEAD_INIT,
"helloworld",
"No documentation for you!",
-1,
myMethods
};
PyMODINIT_FUNC PyInit_helloworld(void)
{
return PyModule_Create(&myModule);
}