来自Python的独立动态库

时间:2014-06-02 17:49:43

标签: python dll dllimport cython py2exe

是否可以使用像--embed flag这样的东西将Cython代码编译到动态库(例如dll)?

e.g。将pyd文件重命名为dll仅显示使用依赖性walker的init方法

相关问题:

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

1 个答案:

答案 0 :(得分:0)

看起来从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     )