一个dll,不能被loadlibrary加载,但是可以使用loadlibraryEx加载,为什么?

babala2009 2008-06-03 10:11:41
一个dll,不能被loadlibrary加载,但是可以使用loadlibraryEx加载(第三参数为DONT_RESOLVE_DLL_REFERENCES),
谁遇到这样的的情况????
...全文
1554 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
na_he 2008-06-03
  • 打赏
  • 举报
回复
应该是我的dll中需要load其他dll的时候,会出错哦,当事业好想找不到具体的原因,最后就用了上面的参数就好了,呵呵!
na_he 2008-06-03
  • 打赏
  • 举报
回复
我以前用loadLibrary失败,然后用LoadLibraryEx(LOAD_WITH_ALTERED_SEARCH_PATH)是因为有时候找不到要加载的dll了,就是第二点了,你看看你是哪一点了,呵呵
区别有三点了:
The differences consist of a set of optional behaviors that LoadLibraryEx provides.
First, LoadLibraryEx can map a DLL module without calling the DllMain function of the DLL.
Second, LoadLibraryEx can use either of two file search strategies to find executable modules that are associated with the specified module.
Third, LoadLibraryEx can load a module in a way that is optimized for the case where the module will never be executed, loading the module as if it were a data file. You select these optional behaviors by setting the dwFlags parameter; if dwFlags is zero, LoadLibraryEx behaves identically to LoadLibrary
Chivalry 2008-06-03
  • 打赏
  • 举报
回复
关注
目前来的,除了lz和我都是星星阿
cnzdgs 2008-06-03
  • 打赏
  • 举报
回复
DLL中隐式链接了其它DLL,但加载的时候找不到。
僵哥 2008-06-03
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 babala2009 的回复:]
GetLastError为找不到模块的路径,但是路径是对的。

Dllmain 中只有一句return TRUE;
[/Quote]
说明有依赖模块找不到。
bobob 2008-06-03
  • 打赏
  • 举报
回复
你是否在同样的环境下调用loadlibrary和loadlibraryEx?
ouyh12345 2008-06-03
  • 打赏
  • 举报
回复
Windows NT/ 2000: If this value is used, and the executable module is a DLL, the system does not call DllMain for process and thread initialization and termination. Also, the system does not load additional executable modules that are referenced by the specified module.

估计关键在additional executable modules
看dll依赖什么别的库
babala2009 2008-06-03
  • 打赏
  • 举报
回复
GetLastError为找不到模块的路径,但是路径是对的。

Dllmain 中只有一句return TRUE;
ouyh12345 2008-06-03
  • 打赏
  • 举报
回复
看dll的DllMain函数,是否做了某些限制
bobob 2008-06-03
  • 打赏
  • 举报
回复
GetLastError看看是啥错误
softman_2000 2008-06-03
  • 打赏
  • 举报
回复
使用DEPENDS.EXE打开你的dll文件,可以看到还需要哪些dll,可能你的dll文件还链接了其它的dll文件,但是没有找到。

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧