本文主要讲述python调用c库时的传入参数为: char* 或者为unsigned char *的情况。
1、传入参数为char*类型时
return_value
= create_string_buffer
(''.encode
(), 20)
ret
= lib_example
.hello
(return_value
)
value
= return_value
.decode
()
for i
in value
:
print(i
)
2、传入参数为unsigned char * 时
return_value
= (c_ubyte
* 20)()
ret
= lib_example
.hello
(return_value
)
for i
in return_value
:
print(i
)
另:返回值为BOOL类型的还没有搞定,知道的大佬可以在下面留言解决方案