Clean 加载dll成功后,引用dll中类的时候报错了,大家帮忙看看有没有遇到的?
Python 中显示错误:
就是这样一个简单的调用
imc_demo = clr.FindAssembly("imc.Studio.ApplicationInterface")
dll_demo= clr.AddReference("imc.Studio.ApplicationInterface")
from imc.Studio.ApplicationInterface import ImcStudioComponent
test = ImcStudioComponent()
这是引用文件:
namespace imc.Studio.ApplicationInterface
{
public class ImcStudioComponent : IDisposable
{
protected string m_appDir;
这是报错的内容:
test = ImcStudioComponent()
TypeError: No constructor matches given arguments: ()
确定加载成功了,动态库中的结构是否对应,确定下
你代码贴出来看看呢,说你没有给需要的参数?
这种调用对dll中函数的声明格式有严格要求的,并不是一般的dll开发模式,好像是严格的C 声明,因为在编译dll中,一般的编译器为了方便装载,会给普通命名的函数额外加一些符号,这样调用时要按新的名称去调用。而专门的声明模式和编译模式才能让python在调用dll中正确调用到期望的函数。