将 32 位 dll 转换为 64 位 dll [英] Convert 32 bit dll to 64 bit dll

查看:208
本文介绍了将 32 位 dll 转换为 64 位 dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在无法加载的 64 位应用程序中使用它时,我有 32 位编译的 dll,所以我想将dll转换为64位.当应用程序的平台从任何 CPU"或x64"更改为x86"时,它工作正常.但是我想在64位下使用它,因为我要从ASP页面调用dll.

I have the 32 bit compiled dll when I try to use it in 64 bit application it fails to load, So I would like to convert the dll to 64 bit. Its working fine when the platform of the application changed from "Any CPU" or "x64" to "x86". But I want to use it under 64 bit, Since I am going to call the dll from ASP pages.

请帮我解决这个问题.

推荐答案

Windows 无法将 32 位 dll 加载到 64 位进程中 - 这是您无法规避的限制.这意味着,如果您的 32 位 DLL 对其他 32 位 DLLS(或使用任何 32 位 .Net DLLS)执行任何 P/调用,您将完全不走运(您将需要以 32 位运行整个网站).

Windows CAN NOT load a 32bit dll into a 64bit process - this is a limitation that you can not circumvent. This means that if your 32bit DLL does any P/Invokes to other 32bit DLLS (or uses any 32bit .Net DLLS) you will be entirely out of luck (you will need to run the entire website in 32bit).

您并不完全清楚它何时有效,何时无效.以下是解释:

You are not entirely clear on when it works and when it doesn't. Here are the explanations:

  1. x86 - 32 位 - 无法加载到 64 位进程中.
  2. x64 - 64 位 - 无法在 32 位机器上执行.
  3. AnyCPU - 双 - 可以在两种环境中加载和执行.

就 AnyCPU 而言:

In terms of AnyCPU:

  1. 64 位机器上的 64 位进程 - DLL 加载为 64 位.
  2. 32 位机器上的 32 位进程 - DLL 加载为 32 位.
  3. 64 位机器上的 32 位进程 - DLL 加载为 32 位.

在大多数情况下,可以将其保留为 AnyCPU.但是,正如我所说,如果您使用任何本机或 .Net 32​​ 位 DLL,您将需要将整个应用程序设为 32 位(并且您无法或 Microsoft 对此无能为力).

In most cases it's fine to leave it as AnyCPU. However, as I said, if you are using any native or .Net 32bit DLLs you will need to make your entire application 32bit (and there is nothing you can, or Microsoft could, do about this).

这篇关于将 32 位 dll 转换为 64 位 dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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