从C ++应用程序调试动态加载的C ++ / CLI DLL [英] Debug a dynamically loaded C++/CLI DLL from a C++ application
本文介绍了从C ++应用程序调试动态加载的C ++ / CLI DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Visual Studio中的C ++新手。
I'm new to C++ in Visual Studio.
我开发了VS解决方案:
I developed a VS solution with:
- 使用
LoadLibraryW $>动态加载A的C ++控制台项目(B) c $ c>
- a C++/CLI DLL project (A)
- a C++ console project (B), which dynamically loads A using
LoadLibraryW
当我运行BI需要在A里面也调试A.但是A的代码中的断点不工作,警告字形说这是不可能打破这里。
When I run B I need to debug also inside A. But breakpoints in A's code are not working, they have a warning glyph saying it is not possible to break here.
我尝试了很多设置,但没有什么工作。这不是一个容易的任务吗?谢谢!
I have tried many settings but nothing worked. Isn't it an easy task? Thanks!
推荐答案
感谢@HansPassant,解决方案是设置此属性:
Thanks to @HansPassant, the solution is to set this properties:
- 项目>属性>调试>调试器类型=混合
- 工具>选项>调试>常规,勾选使用托管兼容模式。
LoadLibrary
没有神奇地启用托管代码,CLR需要首先加载和初始化。
LoadLibrary
doesn't magically enable managed code, the CLR needs to be loaded and initialized first.
这篇关于从C ++应用程序调试动态加载的C ++ / CLI DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文