时间:2022-12-20 10:11:54 | 栏目:Python代码 | 点击:次
python可以做测试c的程序,
用到ctypes模块
ctypes 有以下优点:
ctypes 有以下缺点:
1、编写c函数
2、编译c函数为动态库
3、python2程序里面导入库
from ctypes import *
mm = cdll.LoadLibrary('hello.dll')##或者为hello.so
mm.print()


设置工程


编译




gcc -fPIC -shared test.c -o libtest.so


