参考64位系统中的托管c ++ dll问题 [英] Reference Managed c++ dll in 64-bit systems problem

查看:54
本文介绍了参考64位系统中的托管c ++ dll问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在64位系统的VS2008开发环境中,我写了两个程序,一个C#windows窗体程序,引用一个托管C ++ dll,运行程序结果提示错误FileLoadException错误来自HRESULT异常:0x800736B1



我看到两个程序解决方案平台都设置了anycpu,但是当我的解决方案平台设置为x86时它可以正常运行。

当我设置为x64模式,性能是anycpu模式的情况相同的错误。

问题的主要原因是什么?

解决方案

请查看我过去对相关问题的回答:所有Windows操作系统的应用程序 [ ^ ]。



如果这还不足以让你理解,为了更多地帮助你,我需要你提供更多细节。



-SA


一开始我也认为是依赖于外部环境的dll程序会导致错误,但是当我将程序简化到最小时,问题仍然存在

简化代码非常简单:

c + + dll部分:

 # pragma一次使用 命名空间系统; 

命名空间 CppDll {

public ref class Class1
{
// TODO:在此处为此课程添加您的方法。
};
}



win表单部分:

  public  Form1()
{
CppDll.Class1 cls = new CppDll.Class1();
InitializeComponent();
}


问题解决了,谢谢!

当我下载依赖工具时,查看相关的dll取决于,发现缺少msvcp90.dll和几个类似的文件。所以从C:\ Program Files(x86)\ Microsoft Visual Studio 9.0 \ VC \ redist \ amd64复制到需要文件,问题解决了

VS2008 development environment on 64-bit systems, I wrote two programs, a C # windows form program, reference a managed C + + dll, run the program results prompted an error FileLoadException error Exception from HRESULT: 0x800736B1

I see two programs solution platform is set anycpu,but it can run without problem when I solution platform is set to x86.
When I set to x64 mode, the performance was the same error of the situation anycpu mode.
What is the main reason of the problem?

解决方案

Please see my past answer to related question: application for all windows OS[^].

If this is not enough for you to understand things, to help you more, I would need more detail from you.

—SA


In the beginning I also think that is The dll program dependent on the external environment results in an error, but when I simplify the procedure to a minimum, the problem still exists
Simplified code is very simple:
c + + dll part:

#pragma once

using namespace System;

namespace CppDll {

    public ref class Class1
    {
        // TODO: Add your methods for this class here.
    };
}


win Form part:

public Form1()
{
    CppDll.Class1 cls = new CppDll.Class1();
    InitializeComponent();
}


the problem is solved, thank you!
When I download depends tool, View the related dll depends, found missing the msvcp90.dll and several similar files.So from the C: \ Program Files (x86) \ Microsoft Visual Studio 9.0 \ VC \ redist \ amd64 copied to the need to file, the problem is solved.


这篇关于参考64位系统中的托管c ++ dll问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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