Last active
April 11, 2016 11:19
-
-
Save embray/12a67edb82b213217e31f408007898e6 to your computer and use it in GitHub Desktop.
Example Cython project with sharing between pyx file and plain C file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cdef public void hello(): | |
print "Hello world!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <Python.h> /* Required for foo.h to work--should probably be included directly in foo.h */ | |
#include "foo.h" | |
void greeting(void) { | |
hello(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from setuptools import setup, Extension | |
from Cython.Build import cythonize | |
ext = cythonize(Extension('foo', sources=['foo.pyx', 'fooutil.c'])) | |
setup( | |
name='foo', | |
version='0.1', | |
py_modules=['foo'], | |
ext_modules=ext | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment