如何使用SWIG从Visual Studio 2010创建DLL [英] How to create a DLL with SWIG from Visual Studio 2010

查看:203
本文介绍了如何使用SWIG从Visual Studio 2010创建DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图获得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.

因此,我有.i,.cpp和.h文件,我知道一起创建DLL。我只需要知道如何做到这一点与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.

请不要将我转介到其他网站;因为有机会,我已经在那里试过。

Please don't refer me to another site; because chances are that I've already been there and tried that. Also, please no snarky comments because it's very important that I get this to work in the near future.

非常感谢您的帮助,提前!

Thank you abundantly for your help in advance!

推荐答案

分步说明。这假设你有源代码,并且正在构建一个单独的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.

编辑8/19/2012 :如果以C开头,例如,不要在步骤13中使用 -c ++ ,并使用 .c 而不是

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.


  1. 启动Visual Studio 2010
  2. $

这篇关于如何使用SWIG从Visual Studio 2010创建DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆