LoadLibrary project.dll失败.指定的模块无法找到 [英] LoadLibrary project.dll failed. The specified module could not be found

查看:435
本文介绍了LoadLibrary project.dll失败.指定的模块无法找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试向32位版本的C ++/ATL项目注册

When I try to register the 32 bit version of my C++ / ATL project with

regsvr32 project.dll

我遇到此错误:

LoadLibrary("project.dll") failed - The specified module could not be found

project.dll是我在Visual Studio 10上使用ATL构建的dll.

project.dll is my dll built using ATL on Visual Studio 10.

64位版本注册良好.

The 64 bit version registered fine.

我想念什么?

推荐答案

我已经观察到这个完全相同的错误,但是解决方案未安装可再发行组件.根据depends.exe,所有依赖DLL都存在于系统 1 上.

I have observed this exact same error, but the solution was not installing the redistributable. All the dependent DLLs were present on the system1 according to depends.exe.

在我的情况下, KERNEL32.DLL 的图标带有淡红色. Depends.exe没有提供太多解释,但深入研究发现,系统上的DLL缺少导入的功能之一.要查看导入的功能,请在树视图中选择依赖的DLL ,然后在右侧面板上查找导入.按"PI"列排序以查看丢失的进口的红色图标.

In my case, the icon of KERNEL32.DLL was slightly red tinted. Depends.exe did not offer much explanation, but digging around revealed that one of the imported functions were missing from the DLL on the system. To see the imported functions, select the dependent DLL in the treeview and look for the import on the right panel. Order by the PI column to see the red icons of missing imports.

就我而言,缺少的功能是我悲伤的目标操作系统Windows XP上不存在的功能.由于我的程序不直接依赖于此功能,因此我可以在项目中使用#define删除以下内容:

In my case, the missing function was a function that did not exist on my sad target operating system, Windows XP. Since my program did not directly depend on this function, I was able to get away with #defineing the following in my project:

#define WINVER 0x0501
#define _WIN32_WINNT 0x0501

使用这些宏进行编译,因此未在标头中声明有问题的函数,因此在加载时未导入.现在,我可以使用regsvr32了.当然,这是一个非常具体(也是幸运的)案例.我不依赖于该导入或任何其他较新的API,因此可以重新定位项目.如果不是系统DLL,我将需要找到一个较新的版本,这很容易导致需要更新依赖图的整个子树.甚至更糟的是,如果我依靠缺少的进口,则需要进行一些严重的重构.

Compiling with these macros made it so the function in question was not declared in the headers, and consequently not imported at load-time. Now I was able to use regsvr32. This of course is a very specific (and lucky) case. I did not depend on that import or any other newer APIs, so I could get away with retargeting the project. Were it not a system DLL, I would have needed to find a newer version which could easily lead to a need to update a whole sub-tree of the dependency graph. Or even worse, if I depended on the missing imports, some serious refactoring would be needed.

总结起来,此错误消息 2 可能是由以下问题引起的:

To sum it up, this error message2 can be caused by the following issues:

  1. 找不到或无法读取DLL文件.检查命令行.
  2. 找不到或无法读取某些依赖的DLL.
  3. 某些依赖的DLL中缺少某些导入.如果这些是系统DLL,则可能定位到错误的Windows版本.如果这些是非系统DLL,则需要安装它们的较新版本及其所有依赖项.


1 .:除了IESHIMS.DLL和WER.DLL显然是此旧工具中的错误.
2 .:或者实际上,在特定系统上加载DLL时遇到任何问题

这篇关于LoadLibrary project.dll失败.指定的模块无法找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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