数周以来,我一直在尝试让 Microsoft Visual Studio 2010 使用 SWIG 为我创建一个 DLL.如果你已经经历过这个过程,你会不会好心给一个周到的一步一步的过程解释?我在网上到处找,并花了很多时间试图做到这一点;但我发现的所有教程都已过时或解释不当.
I've been trying for weeks to get Microsoft Visual Studio 2010 to create a DLL for me with SWIG. If you have already gone through this process, would you be so kind as to give a thoughtful step-by-step process explanation? I've looked everywhere online and have spent many many hours trying to do this; but all of the tutorials that I have found are outdated or badly explained.
我已经成功地使用 cygwin 完成了这个过程;但正如你们中的一些人所知,cygwin DLL 不是很实用.
I have succeeded in going through this process with cygwin; but as some of you know, a cygwin DLL is not very practical.
因此,我知道可以一起创建 DLL 的 .i、.cpp 和 .h 文件.我只需要知道如何使用 Visual Studio C++ 2010 执行此操作.我的目标语言是 Python.
As a result, I have .i, .cpp, and .h files that I know can create a DLL together. I just need to know how to do this with Visual Studio C++ 2010. The language that I am targeting is Python.
分步说明.这假设您拥有源代码并且正在构建一个将源直接链接到它的 DLL 扩展.在创建了一个工作项目后,我没有回头,所以我可能错过了一些东西.如果您卡在某个步骤上,请评论此帖子.如果您有一个现有的 DLL 并且想要创建一个包装它的 Python 扩展 DLL,则此步骤略有不同.如果你在这篇文章的评论方面需要帮助,我会扩展它.
Step-by-step instructions. This assumes you have the source and are building a single DLL extension that links the source directly into it. I didn't go back through it after creating a working project, so I may have missed something. Comment on this post if you get stuck on a step. If you have an existing DLL and want to create a Python extension DLL that wraps it, this steps are slightly different. If you need help with that comment on this post and I will extend it.
Edit 8/19/2012:如果从 C 示例开始,请不要在步骤 13 中使用 -c++
并使用 .c
> 代替 .cxx
用于步骤 14 和 19 中的包装文件扩展名.
Edit 8/19/2012: If starting with a C example, don't use -c++
in step 13 and use .c
instead of .cxx
for the wrap file extension in steps 14 and 19.
这篇关于如何从 Visual Studio 2010 使用 SWIG 创建 DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!