【问题标题】:Stand-alone dynamic library from Python来自 Python 的独立动态库
【发布时间】:2014-06-02 17:49:42
【问题描述】:

是否可以使用 --embed 标志之类的东西将 Cython 代码编译为动态库(例如 dll)?

例如将pyd文件重命名为dll只显示使用依赖walker的init方法

相关问题:

How to use Cython to create a stand dll Can Cython compile to an EXE?

【问题讨论】:

  • Protip:如果您的问题的答案(以这种格式,是/否)太短,甚至无法在不添加长度填充符的情况下作为答案发布,这不是一个好问题。这类问题最好在 Python 聊天室提出。
  • @RUJordan 如您所见,我扩展了问题并用参考文献描述了问题

标签: python dll dllimport cython py2exe


【解决方案1】:

看起来从 py2exe 创建一个 COM DLL 是更好的方法:

http://www.py2exe.org/index.cgi/Py2exeAndCtypesComDllServer

  23     my_com_server_target = Target(
  24     description = "my com server",
  25     # use module name for ctypes.com dll server
  26     modules = ["dir.my_com_server"],
  27     # the following line embeds the typelib within the dll
  28     other_resources = [("TYPELIB", 1, open(r"dir\my_com_server.tlb", "rb").read())],
  29     # we only want the inproc (dll) server
  30     create_exe = False
  31     )

【讨论】:

    猜你喜欢
    • 2016-12-31
    • 2011-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-03
    • 2022-01-23
    • 2015-10-05
    相关资源
    最近更新 更多