首页 新闻 会员 周边 捐助

Unable to load DLL XXX.dll, Can not find specified module.(Exception from HRESULT: 0x8007007E)

1
悬赏园豆:20 [已解决问题] 解决于 2012-10-23 23:50

Recently I wrote a small winForm program using C# language. In the app I use C# to invoke a "*.dll" file written in C++. It works all right in my Visual Studio 2012 and on my computer, but when I move it to other computer, it always pops an error about “ Unable to load DLL ' *.dll',can not find specified module.(Exception from HRESULT: 0x8007007E). ”.

I've searched the internet for solution. There are also some similar questions regarding problems that others met and it seems that they also have not found the right solution yet. I also tried some methods like moving my '*.dll' file to windows\system32 or write the app current directory to System Enviroment Variable, but this also didn't work.

I use dependencywalker to check the dependency of the dll,and find two dll missed, then i download them and move them to windows\system32. Also I register them, but my app still can't work..

Now I really don't know how to deal with it. So I'll be very appreciative if someone could give some help.

Mr.Left的主页 Mr.Left | 初学一级 | 园豆:171
提问于:2012-10-03 14:44
< >
分享
最佳答案
0

1、i hope you do not in *nix and really rename your dll file "*.dll"

 

2、if you using "*" for a name like "xxx.dll", I guess it's non-common dll, or you writes it. So get back to your last machine and copy it out (search for the whole disk), Or search the internet for "xxx.dll",which is exactly the dll name, do not use dependencywalker.

 

Or you may want just paste your dll name here, we'll find if it's a user-defined dll.

 

thank u

 

(TMD写英语作文真累,有语法错误就将就着看吧)

收获园豆:20
荣耀属于跪拜猫 | 小虾三级 |园豆:832 | 2012-10-07 10:35

是我自己用C语言写的dll文件,在我自己电脑上能运行,但是换到其他电脑上就无法运行,提示缺少必要组件。。如图:

 

Mr.Left | 园豆:171 (初学一级) | 2012-10-07 21:07

@Mr.Zuo .Net: 

他的查找方式是这样的……首先到运行路径下找,再到path指定的路径下找,我忘记会不会找所在目录了。找不到就报告错误。

 

运行路径不一定是所在的目录,是可以在启动参数里头设置的,或者用cmd的时候,cmd的当前路径(你可以用绝对路径启动).


你可以先确认是不是在这些目录下有。不过如果没有,我查了下,确实是可能少支持库的。

 

如果有depends的话(以前版本的vs自带),用depends看dll的导入表,如果没有,用Dpendency Walker之类的工具看他依赖什么dll,搜索“查看依赖”

荣耀属于跪拜猫 | 园豆:832 (小虾三级) | 2012-10-07 23:06

@猫行天下: dpendency walker 查看是在本地计算机查看还是在其他安装计算机查看? 我在本地查看有缺少组件,然后我从网上下载下来了,然后dpendency walker 就不报错,是否需要将其重新打包?还是其他什么的。。这是第一次用C# 和C 混合编程,写一个完整的程序,也不知道少了什么。。
不知道这是否和CLR方面有关系?我没有学习过太多这方面的东西。。求大神指导啊。。

Mr.Left | 园豆:171 (初学一级) | 2012-10-12 00:20

@Mr.Zuo .Net: dpendency walker不报错不是关键,能不能运行你的解决方案才是关键。和clr没有太大关系,是win加载你dll的时候发现缺少组件。

 

另外,打包的话,直接和你dll放一起就应该可以了。一般都会去那里找。不过有些东西直接放那儿会有一些bug出来……(游戏心得,直接放dll可能会有bug,特别是老滚五),因此要根据dll的类型和名字考虑要不要打包个dll所在项目(例如visual c++2010 runtime)的安装包进去。

 

不过感觉由于vc的runtime的库只放dll出bug的概率还是比较小,老滚五是dx没装只放dll然后就bug了。

荣耀属于跪拜猫 | 园豆:832 (小虾三级) | 2012-10-12 01:40

@猫行天下: 虽然问题没解决,不过还是谢谢你了。

Mr.Left | 园豆:171 (初学一级) | 2012-10-23 23:50
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册