我希望将 char指针数组 传递给C函数。
我参考了http://docs.python.org/library/ctypes.html#arrays 我编写了以下代码。
我参考了http://docs.python.org/library/ctypes.html#arrays 我编写了以下代码。
from ctypes import *
names = c_char_p * 4
# A 3 times for loop will be written here.
# The last array will assign to a null pointer.
# So that C function knows where is the end of the array.
names[0] = c_char_p('hello')
我遇到了以下错误:
类型错误:'_ctypes.PyCArrayType' 对象不支持项目赋值
你有什么想法可以解决这个问题吗?我想要与某些东西进行接口交互。
c_function(const char** array_of_string);