简体   繁体   English

DLL只能通过LoadLibrary正确加载吗?

[英]Dll only loads correctly via LoadLibrary?

I'm trying to use dbghelp.dll. 我正在尝试使用dbghelp.dll。 If I set it up in the VS2008 properties to point to the correct library and header file, and put dbghelp.dll in the same directory as the executable, one of the functions in the dll fails. 如果我在VS2008属性中将其设置为指向正确的库和头文件,并将dbghelp.dll与可执行文件放在同一目录中,则dll中的功能之一将失败。 If I LoadLibrary the dll, everything that function works. 如果我是DLL的LoadLibrary,则该功能正常运行。 I've looked at the header that gets included via the VS option, and the right one is being pulled in. The correct lib is being pulled in (checked via /verbose option), and depends.exe shows the correct dll is loaded. 我已经看过了通过VS选项包含的标头,并且已插入了正确的标头。正插入正确的库(通过/ verbose选项检查),并且depends.exe显示已加载正确的dll。 Does anyone know why I can't get this to work? 有谁知道为什么我无法使它正常工作? I'll probably just go with LoadLibrary, but I'm genuinely stumped on this one. 我可能只会使用LoadLibrary,但是我确实对这一点感到困惑。

EDIT: SymfromAddr fails with an "error 87", whatever that is. 编辑:SymfromAddr失败,并显示“错误87”,无论是什么。 If I load the dll via LoadLibrary, it works. 如果我通过LoadLibrary加载dll,它将起作用。

Did you linked with Dbghelp.lib via proj settings or #pragma comment(lib,"Dbghelp.lib") ? 您是否通过项目设置或#pragma comment(lib,“ Dbghelp.lib”)与Dbghelp.lib链接? If you do the dll will be loaded during app initialization. 如果执行此操作,则将在应用初始化期间加载dll。

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

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