Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. cdef public api char* say_hi():
  2. return "hello from python!"
  3.  
  4. #include <Python.h>
  5. #include "hello.h"
  6.  
  7. int main() {
  8. Py_Initialize();
  9. char *hi = say_hi();
  10. printf("%sn", hi);
  11. Py_Finalize();
  12. }
  13.  
  14. gcc `python2-config --cflags --ldflags` -o compiledhi sayhi.c
  15.  
  16. Undefined symbols for architecture x86_64:
  17. "_say_hi", referenced from:
  18. _main in sayhi-302608.o
  19. ld: symbol(s) not found for architecture x86_64
  20. clang: error: linker command failed with exit code 1 (use -v to see invocation)
  21.  
  22. gcc `python3-config --cflags --ldflags` -o compiledhi sayhi.c
  23.  
  24. #include <Python.h>
  25. #include "hello_api.h"
  26.  
  27. int main() {
  28. Py_Initialize();
  29. import_hello();
  30. char *hi = say_hi();
  31. printf("%sn", hi);
  32. Py_Finalize();
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement