py2exe生成dll? [英] py2exe to generate dlls?
本文介绍了py2exe生成dll?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法使用py2exe或其他方法来生成dll文件而不是exe文件?
我想要基本上创建一个正常的功能的win32 dll但是这些函数将以python而不是c ++编码。
解决方案
我想你可以通过做一些黑客来解决这个问题: p>
- 查看py2exe中的zipextimporter模块。它有助于从zip导入pyd文件。
- 使用它,您可以使用raw python-api将py2exe的输出文件加载到您自己的应用程序/ dll中。 (如果可以,请使用boost :: python)
- 而且,由于py2exe的输出文件是zip,您可以将其附加到dll的末尾,使整个事情更加集成。 (旧技巧也适用于jar文件。)
没有测试,但我认为理论是正确的。
本质上,您可以在您的DLL中重新实现py2exe的输出可执行文件的main()。
Is there a way using py2exe or some other method to generate dll files instead of exe files?
I would want to basically create a normal win32 dll with normal functions but these functions would be coded in python instead of c++.
解决方案
I think you could solve this by doing some hacking:
- Take a look at the zipextimporter module in py2exe . It helps with importing pyd-files from a zip.
- Using that, you might be able to load py2exe's output file in your own app/dll using raw python-api. (Use boost::python if you can and want)
- And, since py2exe's outputfile is a zip, you could attach it at the end of your dll, making the whole thing even more integrated. (Old trick that works with jar-files too.)
Not tested, but I think the theory is sound.
Essentially, you reimplement py2exe's output executable's main() in your dll.
这篇关于py2exe生成dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文