无法在 VS 2010 中运行 SWIG C# 示例
我正在尝试让 SWIG 与 Visual Studio 和 C# 一起使用。
我下载了 swigwin-2.0.4.zip 并将项目转换为VS 2010项目。
我能够构建“类”示例。当我尝试运行已编译的构建时,出现错误,
The type initializer for 'examplePINVOKE' threw an exception.
我已在 google 上搜索了该错误,但没有找到有关如何解决该错误的任何建议。
希望有人能够提供帮助!
谢谢,
克里斯蒂安
I am trying to get SWIG to work with Visual Studio and C#.
I downloaded swigwin-2.0.4.zip and converted the project to a VS 2010 project.
I am able to build the 'class' example. When I then try to run compiled build I get the error
The type initializer for 'examplePINVOKE' threw an exception.
I haved googled the error, but have not found any suggestions on how to resolve it.
Hope somebody is able to help!
Thanks,
Christian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对我有用的是:
AnyCpu
更改为x86
并重建。不需要 CorFlags。
What worked for me was to:
AnyCpu
tox86
and rebuild.Doesn't require CorFlags.
我在 swig-user 邮件列表上从 Gregory Bronner 那里得到了以下答案:
我将尝试这些提示,看看它们是否有效,然后在能够解决问题时发布答案。
I got the following answer from Gregory Bronner on the swig-user mailinglist:
I will try these hints out and see whether they work and then post an answer if I am able to resolve the issue.
对我来说,解决方案是
其中 file.exe 是通过构建代码生成的可执行文件。
有关所发生情况的更多信息 Í 发现以下链接很有帮助
http ://www.davesquared.net/2008/12/systembadimageformatexception-on-64-bit.html
http://blogs.msdn.com/b/joshwil/archive /2005/05/06/415191.aspx
The solution for me was
where file.exe is the executable produced by building the code.
For more information on what is going on Í found the following links helpful
http://www.davesquared.net/2008/12/systembadimageformatexception-on-64-bit.html
http://blogs.msdn.com/b/joshwil/archive/2005/05/06/415191.aspx