python如何调用c函数
在python中使用ctypes模块调用c函数,具体方法如下:
from ctypes import * #导入ctypes模块
handle = cdll.LoadLibrary('libtest.so')
func = handle.printStr
func.argtypes = (c_char_p,c_char_p)
func.restype = c_char_p
tmp = handle.printStr("hello".encode("utf-8"),"world".encode("utf-8"))
print(tmp.decode("utf-8"))
输出结果为:
helloworld
版权声明
本文仅代表作者观点,不代表米安网络立场。
上一篇:常见漏洞修复的工具有哪些 下一篇:怎么对漏洞进行分类和优先级排序
发表评论:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。