【问题标题】:Build .NET DLLs from Python code?从 Python 代码构建 .NET DLL?
【发布时间】:2011-03-11 17:37:43
【问题描述】:

如何制作用 python 代码 (IronPython) 编写的 DLL (.NET)?

【问题讨论】:

    标签: python dll build ironpython compilation


    【解决方案1】:

    您无法从 IronPython 代码创建标准 .NET .dll(可直接从 C# 或 VB 使用的.dll)。

    pyc.py 生成只能由 IronPython 使用的 .dll - 使用 Reflector 检查此类 .dll,您就会明白为什么。

    【讨论】:

      【解决方案2】:

      您可能可以使用ironpycompiler,使用http://pythonhosted.org//ironpycompiler/html-en/command-line.html 中的示例。它需要安装 IronPython 和 CPython(常规 Python)。

      【讨论】:

      • 来自文档:IronPyCompiler 是一个库,用于将需要来自 Python 标准库(或第三方纯 Python 模块)的模块的 IronPython 脚本编译成独立的 .NET 程序集(DLL 文件或一个可执行文件),使用 pyc.py。
      【解决方案3】:

      您可以在C:\Program Files\[IronPython Program Directory]\Tools\Scripts 使用脚本。

      【讨论】:

      • 问题是我是否可以将它们编译成可移植的 DLL
      • 您的意思是可以从 C# 中使用的 DLL?我不认为这是可能的。我可能是错的。
      • 是的,我就是这个意思。但我的意思是它应该附加到项目中,而不是用 或其他强硬方式调用。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-04-07
      • 1970-01-01
      • 1970-01-01
      • 2011-04-02
      • 2023-03-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多