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

查看:116
本文介绍了如何根据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.setdll目录

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

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