未安装 vs2008 的 Windows 7 上的 c++/cli dll 问题
好的,这就是我今天的怪异之处。
我创建了现有 C++ 程序的扩展,但我无权访问源代码。
我编写标准 C/C++ dll,并使用 IJW 调用 C# dll。我已经有一段时间没有这样做了,但现在我正试图让它在 Window 7 上工作。我收到一个错误(错误 0000036B1 - 不确定这是应用程序的内部错误号,还是 Windows 错误。
我有多个虚拟电脑(XP 和 Windows 7) 如果安装了 Visual Studio 2008,该 dll 在 XP 上也能正常工作,但在仅带有 Microsoft Visual C++ 2008 SP1 Redistributable Package 的干净 Windows 7 上则不行。 只要将编译器开关设置为 MT[d] ,
我就可以在干净的 Windows 7 机器上直接编译和运行 C++ dll,但如果我设置 /clr 开关,则必须将其更改为 MD[d],然后再进行更改。在干净的 Windows 7 机器上失败,但是在安装了 Visual Studio 2008 的 Windows 7 机器上失败。
关于我需要在干净的机器上安装什么有什么想法吗?(当然不是 VS;-))
感谢您的帮助。
L·李·桑德斯
OK, here is my weirdness for today.
I create extensions to an existing C++ program that I DO NOT have access to the source code.
I write standard C/C++ dlls and I use IJW to call C# dlls. I have not done this in awhile, but now I'm trying to get one to work on Window 7. I get an error (Error 0000036B1 - Not sure if that is an internal error number to the application, or a windows error.
I've got multiple virtual pcs (XP and Windows 7) The dll works just fine on XP. It also works on Windows 7 if Visual Studio 2008 is installed. but not on a clean Windows 7 with just the Microsoft Visual C++ 2008 SP1 Redistributable Package installed.
I can compile and run straight C++ dlls on the clean Windows 7 box as long as the compiler switch is set to MT[d] but if I set the /clr switch, I must change that to MD[d] and then it fails on the clean Windows 7 box. But, not on the Windows 7 box with Visual Studio 2008 installed.
Any ideas on what I need to install on the clean box? (other than VS of course ;-) )
Thanks for your help.
L. Lee Saunders
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好吧,这很糟糕。有人指出我需要的文件是调试版本,这意味着我已经在调试模式下编译了 dll。他建议我尝试释放模式。
因此,使用运行 Windows 7 Basic 的虚拟 PC 的新副本(安装了 3.5 C++ redist),我复制了原始 dll(调试模式下的 dll),只是为了验证该虚拟 PC 是否存在问题。是的,确实如此。
然后我复制了一个在Release模式下编译的dll。它起作用了。
好吧,我正式想把头撞到墙上。
感谢您抽出时间。
L·李·桑德斯
OK this is bad. Someone pointed out that the files I needed were the debug versions and that meant that I had compiled my dll in debug mode. He suggested that I try release mode.
So, with a new copy of my Virtual PC running Windows 7 Basic (this the 3.5 C++ redist installed) I copied over my original dll (the one in debug mode) just to verify that this Virtual PC had the issue. Yep it did.
Then I copied over a dll that was compiled in Release mode. It worked.
Ok, I officially want to pound my head on a wall.
Thanks for your time.
L. Lee Saunders
您将需要 VC++ Runtime Redistributable(具有本机 C++ 的支持代码)和 .NET Framework 3.5(具有 C++/CLI 的支持代码)。
.NET 3.5 应该随 Win7 一起提供,但 VS2008 SP1 附带 .NET 3.5 SP1,因此我建议从 Windows Update 安装所有 .NET 更新。
You will need both the VC++ Runtime Redistributable (which has support code for native C++) and the .NET Framework 3.5 (which has support code for C++/CLI).
.NET 3.5 should come with Win7, but VS2008 SP1 comes with .NET 3.5 SP1 so I would recommend installing all the .NET updates from Windows Update.
现在我感觉很糟糕。这并不是完全全新的 Windows 7 安装。我需要安装我正在为其编写扩展的应用程序。该程序的最新补丁安装了 Visual C++ 2008 SP1 Redistributable 软件包。
好吧,我决定尝试创建一个 C++/cli dll 的安装项目,并告诉它包含依赖项。它拉入了 2 个文件:
c:\program files\common files\merge module\microsoft_vc90_debugcrt_x86.msm
C:\Program Files\Common Files\Merge Modules\policy_9_0_Microsoft_VC90_DebugCRT_x86.msm
我运行了安装,这个小应用程序工作了。我手动复制了我的 dll,你瞧,它们现在可以工作了。所以为了让它工作,我需要这两个文件。
为什么?为什么它们没有包含在 Redist 包中?
Now I feel bad. It was not completely a clean install of Windows 7. I needed to install the app that I'm writing extensions for. That programs' latest patch installed the Visual C++ 2008 SP1 Redistributable package.
Well, I decided to try creating an install project of a little bitty C++/cli dll and told it to include dependancies. It pulled in 2 files:
c:\program files\common files\merge modules\microsoft_vc90_debugcrt_x86.msm
C:\Program Files\Common Files\Merge Modules\policy_9_0_Microsoft_VC90_DebugCRT_x86.msm
I ran the install and the tiny app worked. I manually copied over my dlls and lo and behold they worked now to. So to get it to work I needed these two files.
Why? And why were they not included in the Redist package?