在linux环境下python与C++混合编程

参考:在linux环境下编译C++ 程序

linux下python3调用c代码或者python3调用c++代码

https://blog.csdn.net/u013179327/article/details/43735963(python脚本利用ctypes调用c模块返回字符串

https://www.cnblogs.com/tataerzu/p/10126483.html(python中字节与字符串的转换

 

gcc -c -fPIC sm9so_linux.cpp

g++ -shared sm9so_linux.cpp -o sm9so_linux.so

 

gcc -c -fPIC sm9so_linux.cpp

g++ -shared sm9so_linux.cpp -fPIC -o sm9so_linux.so

 

g++ -g -o sm9so_linux.so -I ./kk sm9so_linux.cpp -L /usr/lib/x86_64-linux-gnu/ -lmysqlclient -lz -lpthread -shared -fPIC

 

g++ -g -o sm9so_linux.so -I ./kk sm9so_linux.cpp -L /usr/lib/x86_64-linux-gnu/ -lpthread -shared -fPIC

 

g++ -shared sm9so_linux.cpp -fPIC -o sm9so_linux.so -Xlinker --unresolved-symbols=ignore-in-shared-libs

 

posted @ 2020-02-06 17:03  m0w3n  阅读(759)  评论(0编辑  收藏  举报