加载C ++ DLL时C#崩溃 [英] C# crash when loading C++ dll

查看:147
本文介绍了加载C ++ DLL时C#崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序是使用C#.NET 2.0编写的,它使用的是使用Microsoft Visual Studio 2008 SP1在C ++编写的dll中的外部函数。
如果我从程序放置的目录中删除dll,程序会在使用dll时崩溃。这是正常的。



但是用户正在使用我的程序在同一个地方得到相同的错误,而不需要移动dll。他们都有C ++ Redistributable 2008从> here<



是否发生,因为我将程序.NET 2.0而不是NET 3.5或者它发生,因为可再分发应该是一个较旧的版本?



编辑:注意,我的程序运行正常。



>>新线程<<

解决方案

它最有可能是错误的运行时。确保您正在分发正确的。这些将始终在您的开发框中工作,因为运行时在路径中。对于测试软件,我使用的是Windows XP虚拟机。我将虚拟机设置为全新的安装,安装我需要的组件(.NET框架等),然后运行我的安装程序。你会遇到这么多的设置问题。


My program is written in C# NET 2.0,it's using external functions from a dll written in C++ using Microsoft Visual Studio 2008 SP1. If I remove the dll from the directory the program is placed,the program crashes at the moment it should use the dll.That's normal.

But the users that are using my program get the same error at the same place without moving the dll.They all have C++ Redistributable 2008 from >here<

Does it happen because I made the program in .NET 2.0 instead of NET 3.5 or it happens ,because the redistributable should be an older version?

Edit:Note for me,the program runs fine.

>>new thread<<

解决方案

Its most likely the wrong runtime. Make sure you are distributing the correct one. These will always work on your dev box because the runtimes are in the path. For testing software, I use a windows xp virtual machine. I set up the virtual machine as a completely fresh install, install the components I know that I need (.NET framework, etc.), then run my installer. You will run into a surprising number of setup issues doing this.

这篇关于加载C ++ DLL时C#崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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