好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

python如何调用c语言函数的使用详解

下面小编就为大家带来一篇python 调用c语言函数的实例讲解。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧

#include <stdio.h>

char *get_str()
{
 return "hello,world"
} 
from ctypes import *

dll = CDLL("./hello.so")
dll.get_str.restype = c_char_p
str = dll.get_str()
print(string_at(str, 11)) 
[feng@arch python_c]$ python test.py 
hello,world 

以上就是python如何调用c语言函数的使用详解的详细内容,更多请关注Gxl网其它相关文章!

查看更多关于python如何调用c语言函数的使用详解的详细内容...

  阅读:47次