mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 11:49:12 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
	
		
			340 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
	
		
			340 B
		
	
	
	
		
			C
		
	
	
	
	
	
#include "Python.h"
 | 
						|
 | 
						|
static PyObject *
 | 
						|
ex_foo(PyObject *self, PyObject *args)
 | 
						|
{
 | 
						|
	printf("Hello, world\n");
 | 
						|
	Py_INCREF(Py_None);
 | 
						|
	return Py_None;
 | 
						|
}
 | 
						|
 | 
						|
static PyMethodDef example_methods[] = {
 | 
						|
	{"foo", ex_foo, METH_VARARGS, "foo() doc string"},
 | 
						|
	{NULL, NULL}
 | 
						|
};
 | 
						|
 | 
						|
PyMODINIT_FUNC
 | 
						|
initexample(void)
 | 
						|
{
 | 
						|
	Py_InitModule("example", example_methods);
 | 
						|
}
 |