How can use CFFI to call an existing C function given the source code?
问题 I have a C source/header file that are part of a bigger project. I would like to test this as a unit, independent of the real project. While it would be possible to do this in C by creating a new project with a different main() , I would like to see if I can use Python (3) and its frameworks (eg. nose) to accelerate the construction of tests, use existing reporting frameworks, etc. I was under the impression that I could do this with CFFI. Here's a sample C file: // magic.c // Implementation