c# - 在 Linux Python 中使用 .NET Core 库

标签 c# python linux .net-core

我使用 .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'

最佳答案

请参阅documentation

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/

相关文章:

python - 导入错误 : No module named yaml in Keras (neural network)

linux - 如何使 BASH 脚本仅在特定目录中运行?

c# - 具有一个类的多个公共(public)别名的类库

c# - 如何从sql函数中读取返回值

c# - 获取可绘制资源

python - python 集合可以包含的值的数量是否有限制?

python - 如何在Python中的大集合变量中找到最接近的字符串匹配?

python - NameError : name 'hasattr' is not defined - Python3. 6, Django1.11, Ubuntu16-17, Apache2.4, mod_wsgi

php - ubuntu系统启动添加ssh

c# - 我们可以在同一个类C#中调用一个方法吗