[英]How to load DLL using Iron python?
I wrote the simplest DLL using C# and copied it to the desktop.我使用 C# 编写了最简单的 DLL 并将其复制到桌面。 Now I wanted to load the DLL in order to see that I can use the API but I get some errors:
现在我想加载 DLL 以查看我是否可以使用 API,但出现了一些错误:
the code I used: (edited after looking at some questions here)我使用的代码:(在这里查看了一些问题后进行了编辑)
import clr
import sys
sys.path.Add("C:\Desktop\DLLTest.dll")
clr.AddReference("C:\Desktop\DLLTest.dll")
I get this error :我收到此错误:
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: System.IO.IOException: Could not add reference to assembly DLLTest.dll
what is needed to be added to sys path?需要将什么添加到 sys 路径? why?
为什么? thanks!!!
谢谢!!!
User clr.AddReferenceToFileAndPath
and double your backslashes.用户
clr.AddReferenceToFileAndPath
并加倍反斜杠。 So:所以:
import clr
clr.AddReferenceToFileAndPath('C:\\Desktop\\DLLTest.dll')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.