Mapping a global variable from a shared library with ctypes

前端 未结 1 1398
长发绾君心
长发绾君心 2020-11-27 20:43

I\'d like to map an int value pbs_errno declared as a global in the library libtorque.so using ctypes.

Currently I can load the library lik

相关标签:
1条回答
  • 2020-11-27 21:12

    There's a section in the ctypes docs about accessing values exported in dlls:

    http://docs.python.org/library/ctypes.html#accessing-values-exported-from-dlls

    e.g.

    def pbs_errno():
        return c_int.in_dll(libtorque, "pbs_errno")
    
    0 讨论(0)
提交回复
热议问题