调试 VC++ 6 从 C# 调用 DLL

发布于 2024-12-05 17:00:36 字数 190 浏览 1 评论 0原文

我有一个用 Visual Studio 6 编写的旧 DLL,我从用 Visual Studio 2010 编写的 C# 调用它。该 DLL 无法正常工作,我想对其进行调试。我该怎么做?我有源代码项目,但不知道如何进入它。

注意:当我说“不起作用”时,对 DLL 的调用会成功,并且在失败之前会稍微浏览一下 DLL 中的代码,但我想准确地追踪到哪里。

I have an old DLL written in Visual Studio 6 which I am calling from C# written in Visual Studio 2010. The DLL is not working properly and I want to debug into it. How can I do this? I have the source code project but cannot see how I can step into it.

Note: When I say "doesn't work", the call to the DLL succeeds and it gets a little way through the code in the DLL before failing, but I want to track down exactly where.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

も星光 2024-12-12 17:00:36

MSDN 上此处描述了调试 DLL 的技术。您需要从 Visual Studio 6(即开发 DLL 的工具)中执行此操作,因此术语将发生变化。但原则是一样的。

The technique of debugging a DLL is described here on MSDN. You'll need to do this from Visual Studio 6 (i.e. the tool that developed the DLL) and so the terminology will have changed. But the principles remain the same.

装纯掩盖桑 2024-12-12 17:00:36

只要您拥有带有相应二进制文件和源代码的 PDB 文件,就可以在 .NET 进程上附加 VS6 调试器。但是,您只能中断 DLL 代码。

如果选中“允许非托管调试”标志,则附加另一个 VS+ 应该可以工作,但调试器可能不会加载符号。重新编译 DLL 将解决最后一个问题。

Attaching VS6 debugger on the .NET process shall work, as long you have the PDB file with the corresponding binary and the sources. You can break only on DLL code, however.

Attaching another VS+ shall work if the flag "Allow unmanaged debugging" is checked, but there is a possibility that symbols are not loaded by the debugger. A recompilation of the DLL shall solve the last problem.

烟花肆意 2024-12-12 17:00:36

打开Visual C++ Dll项目,在需要的地方设置断点。在“项目属性”、“调试”、“调试会话的可执行文件”中,键入使用此 Dll 的 .NET 可执行文件。开始调试 (Go)。当调用 VC++ 函数时,调试器会中断。使用这种方式,您只能调试非托管 VC++ 代码。

另一种方法是从 .NET 客户端以混合调试模式开始调试。将 VC++ 项目添加到解决方案并重建它以调试托管和非托管代码。

Open Visual C++ Dll project, set breakpoint where you need. In the Project properties, Debug, Executable for debug session, type .NET executable file which uses this Dll. Start debugging (Go). When VC++ function is called, debugger breaks. Using this way, you can debug only unmanaged VC++ code.

Another way is to start debugging from .NET client in mixed debugging mode. Add VC++ project to the solution and rebuild it to debug both managed and unmanaged code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文