如何根据 CPU 架构使用正确的非托管 DLL 文件?(32/64 位) [英] How to use the correct unmanaged DLL file according CPU architecture? (32 / 64 bits)

查看:23
本文介绍了如何根据 CPU 架构使用正确的非托管 DLL 文件?(32/64 位)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用来自 ASP.NET 站点的 C++ DLL 文件.该网站将托管在 32 位和 64 位环境中.

I have to use a C++ DLL file from an ASP.NET site. The site will be hosted on both 32 and 64 bits environments.

我有一个 32 位和 64 位版本的非托管 DLL 文件.如何根据当前服务器架构从正确的方法中导入方法?

I have a 32 and 64 bits version of the unmanaged DLL file. How do I import the methods from the correct one according the current server architecture?

就像有人发布的那样,这可以作为部署问题来处理.我担心的是:使用这个 DLL 文件的 Web 应用程序很大,而且我们没有部署文档.没有人会记得部署正确的 DLL 文件,所以我试图从解决方案中删除人为因素:)

Like someone posted, this could be handled as a deployment problem. My concern is: the web application consuming this DLL file is huge, and we don't have a deployment document. No one will remember to deploy the correct DLL file, so I'm trying to remove the human factor from the solution :)

推荐答案

最简单的方法是在两个不同的目录中为两个本机库提供相同的文件名,然后 根据位数调整您的应用程序 DLL 搜索路径.

Simplest approach would be to give the two native libraries the same filename in two different directories, then adjust your application DLL search path depending on the bitness.

http://www.pinvoke.net/default.aspx/kernel32.setdlldirectory

这篇关于如何根据 CPU 架构使用正确的非托管 DLL 文件?(32/64 位)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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