我使用 .NET Core 在 Linux 中编写了一个 C# 库。现在我想在 python 中使用它。有人对这个话题有经验吗?这可能吗?
我试过
import ctypes as ct
lib = ct.WinDLL("PythonTest.dll")
但是我运行在这个错误中
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: 'module' object has no attribute 'WinDLL'
最佳答案
On Linux, it is required to specify the filename including the extension to load a library, so attribute access can not be used to load libraries. Either the LoadLibrary() method of the dll loaders should be used, or you should load the library by creating an instance of CDLL by calling the constructor:
WinDLL()
适用于 Linux 上的 Windows,您需要使用 .LoadLibrary()
或 CDLL()
关于c# - 在 Linux Python 中使用 .NET Core 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50540709/