How can I call a DLL from a scripting language?

后端 未结 5 1996
离开以前
离开以前 2020-12-31 15:37

I have a third-party product, a terminal emulator, which provides a DLL that can be linked to a C program to basically automate the driving of this product (send keystrokes,

5条回答
  •  爱一瞬间的悲伤
    2020-12-31 16:19

    The Python Py_InitModule API function allows you to create a module from c/c++ functions which can then be call from Python.

    It takes about a dozen or so lines of c/c++ code to achieve but it is pretty easy code to write:

    https://python.readthedocs.org/en/v2.7.2/extending/extending.html#the-module-s-method-table-and-initialization-function

    The Zeus editor that I wrote, uses this appoach to allow Zeus macros to be written in Python and it works very well.

提交回复
热议问题