After Cython "Hello World" and an example of calling a function in C-math libraries here , I really want to do this in order to have my C-code in a separate file and use it with Cython. Following this , I modify the setup.py file:
sourcefiles = ['hello2_caller.pyx', 'hello2.c']
This is hello2.c (main only for compilation and testing separately), although this product is not available for the test:
#import <stdio.h> void f() { printf("%s", "Hello world!\n"); } int main(int argc, const char* argv[]) { f(); return 0; }
This is hello2_caller.pyx
cdef extern from "hello2.c": void f() cpdef myf(): f()
I get:
In file included from hello2_caller.c:219: hello2.c:3: warning: function declaration isn't a prototype
So, I think that I can not provide the header in some way .. although it just feeds setup.py, a standard header such as "hello2.h" does not work. Can you point me to a working example or explain what I'm doing wrong. Thanks.
telliott99
source share