我想用.NET库用Python控制电机控制器(8742,New Focus)。我使用Python 2.7和Anaconda发行版。 在.dll文件中有一个我必须先调用的构造函数。从文档中我有关于构造函数的这些信息。
/// <summary>
/// Constructor.
/// </summary>
public CmdLib8742 ()
/// <summary>
/// Constructor.
/// </summary>
/// <param name="logging">True to request logging, otherwise false.</param>
/// <param name="msecDelayForDiscovery">The number of milliseconds to wait for devices to be discovered.</param>
/// <param name="deviceKey">The first device in the list of open instruments (null = none found).</param>///
public CmdLib8742 (bool logging, int msecDelayForDiscovery, ref string deviceKey)
我的Python代码如下所示:
import ctypes as c
class Picomotor:
def __init__(self):
self.dll = c.cdll.LoadLibrary('C:\\Program Files\\New Focus\\New Focus Picomotor Application\\Bin\\CmdLib8742.dll')
self.dll.CmdLib8742()
如果我在控制台中写字
Picomotor()
我收到错误“AttributeError:function'CmdLib8742'not found”
如何正确调用构造函数并使用.dll文件中的函数(示例中未显示)?
非常感谢您的帮助。
PS:之前的答案对我没有帮助。