Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cdef public api char* say_hi():
- return "hello from python!"
- #include <Python.h>
- #include "hello.h"
- int main() {
- Py_Initialize();
- char *hi = say_hi();
- printf("%sn", hi);
- Py_Finalize();
- }
- gcc `python2-config --cflags --ldflags` -o compiledhi sayhi.c
- Undefined symbols for architecture x86_64:
- "_say_hi", referenced from:
- _main in sayhi-302608.o
- ld: symbol(s) not found for architecture x86_64
- clang: error: linker command failed with exit code 1 (use -v to see invocation)
- gcc `python3-config --cflags --ldflags` -o compiledhi sayhi.c
- #include <Python.h>
- #include "hello_api.h"
- int main() {
- Py_Initialize();
- import_hello();
- char *hi = say_hi();
- printf("%sn", hi);
- Py_Finalize();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement