简体   繁体   English

如何跟踪用过的DLL(是所谓的DLL hell吗?)

[英]How to trace used DLL (is it so-called DLL hell ?)

It should be a simple problem, but I do be stumbled on it. 这应该是一个简单的问题,但我确实对此感到迷惑。 The environment is Visual Studio 2008 on Windows 7, the machine also has vs2010, vs2012 installed. 环境是Windows 7上的Visual Studio 2008,该计算机还安装了vs2010,vs2012。 (I have to install several VS because various project uses different version) (我必须安装多个VS,因为各种项目使用不同的版本)

I have a simple application uses some 3-rd DLLs. 我有一个简单的应用程序,它使用一些3rd DLL。 1). 1)。 When the app is launched from Vs, it is OK. 从Vs启动应用程序后,就可以了。

2). 2)。 When I copied the DLLs to execute file and launched it from Explorer, the application crashed on C++ library 当我复制DLL来执行文件并从资源管理器中启动它时,该应用程序在C ++库上崩溃了

Something like: Program: xxx.exe File: c:\\program files\\microsoft visual studio 9.0\\vc\\include\\vector Line: 779 Expression: vector subscript out of range 类似于:程序:xxx.exe文件:c:\\ program files \\ microsoft visual studio 9.0 \\ vc \\ include \\ vector行:779表达式:矢量下标超出范围

3). 3)。 I opened a command line and add 'Visual Studio 9.0\\' and 'Visual Studio 9.0\\vc\\bin' before PATH environment variable and launched the app, it also crashed. 我打开了一个命令行,并在PATH环境变量之前添加了“ Visual Studio 9.0 \\”和“ Visual Studio 9.0 \\ vc \\ bin”,并启动了该应用程序,它也崩溃了。

I've attached to manual launched/crashed process and compared it with Vs IDE lanuched process for modules and PATH environment, it seems same.... I was frustrated. 我已经附加了手动启动/崩溃的过程,并将其与针对模块和PATH环境的Vs IDE简化的过程进行了比较,这似乎是相同的...。

Any suggestion? 有什么建议吗? Thanks in advanced. 提前致谢。


I found the reason just now. 我刚才找到了原因。 In Visual Studio, there is a 'Debugging | 在Visual Studio中,有一个“调试| Working Directory' setting, it is project directory by default. 工作目录”设置,默认为项目目录。 Although I copied all DLLs, I missed some configuration file. 尽管我复制了所有DLL,但是我错过了一些配置文件。 It's application logic error. 这是应用程序逻辑错误。

使用SysInternals的进程监视器来跟踪加载了哪个DLL。

I would recommend using Dependency Walker to debug dependency issues. 我建议使用Dependency Walker来调试依赖关系问题。

You can use it in a static mode, or a dynamic mode (from the Profile menu) to diagnose exactly what the loader is doing at runtime. 您可以在静态模式下使用它,也可以在动态模式下(从“配置文件”菜单中使用它)来诊断诊断装载程序在运行时正在做什么。 The latter mode sounds like what you are looking for. 后一种模式听起来像您想要的。

'vector subscript out of range' issue seems to be more from your code rather than the DLL dependency issue. “向量下标超出范围”的问题似乎更多是源于您的代码,而不是DLL依赖关系问题。 However, make sure to reference the correct version of the DLLs - Debug/Release. 但是,请确保引用正确版本的DLL-调试/发布。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM