python调用C++,C++函数返回一个结构体变量给PYTHON,python如何接收呢?

如题:谢谢?
2025-04-02 05:33:04
推荐回答(1个)
回答1:

用 ctypes, 接收返回的对象建个类, 类似下面这种:


from ctypes import *
class StandGo(Structure):
    _fields_ = [("x", c_int),("y", c_int)]
    
 接收对象赋值给这个类应该就可以了
 具体的看ctypes的文档了,自己试下了