[英]Pass the address of a Python structure to a C function
I want to pass the address of a structure to a C program. 我想将结构的地址传递给C程序。 In CI would use something like fun(&vendorRecord).
在CI中将使用诸如fun(&vendorRecord)之类的东西。 I have tried various forms I have found on the internet but nothing works.
我尝试了在互联网上找到的各种表格,但没有任何效果。 Can someone give me a suggestion?
有人可以给我一个建议吗?
My structure looks like this: 我的结构如下所示:
class vendrRecord(Structure):
_pack_ = 1 # pack the struct
_fields_ = [
("vendorListNumber" ,c_ubyte *(5)),
("vendorNumber" ,c_ubyte *(5)),
]
My C structure looks like this: 我的C结构如下所示:
struct {
unsigned char vendorListNumber[5];
unsigned char vendorNumber[5];
} vendrRecord;
My C prototype looks like this: 我的C原型如下所示:
void fun(void *record);
My C call looks like this: 我的C调用看起来像这样:
fun(&vendrRecord);
VendrRecord = vendrRecord()
fun(byref(VendrRecord))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.