python ctype recursive structures

后端 未结 3 1603
一向
一向 2020-11-30 11:53

I\'ve developped a DLL for a driver in C. I wrote a test program in C++ and the DLL works fine.

Now I\'d like to interract with this DLL using Python. I\'ve successf

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-30 12:01

    You'll have to access _fields_ statically after you've created it.

    class EthercatDatagram(Structure)
      _fields_ = [...]
    
    EthercatDatagram._fields_.append(("next_command", EthercatDatagram))
    

提交回复
热议问题