mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	A directory with a working example of how to build an extension.
This commit is contained in:
		
							parent
							
								
									5c1d1ee8a8
								
							
						
					
					
						commit
						026f01a297
					
				
					 4 changed files with 417 additions and 0 deletions
				
			
		
							
								
								
									
										21
									
								
								PC/example_nt/example.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								PC/example_nt/example.c
									
										
									
									
									
										Normal 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); | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Guido van Rossum
						Guido van Rossum