cpp #include <iostream> void sayHello() { std::cout << "Hello from C++!" << std::endl; } c %module hello %{ %} extern void sayHello(); shell $ swig -python hello.i python import hello hello.sayHello() shell $ g++ -c -fPIC hello.cpp hello_wrap.cxx -I/usr/include/python3.8 $ g++ -shared hello.o hello_wrap.o -o _hello.so $ python main.py


上一篇:
下一篇:
切换中文