Visual Studio 2005 VB 调试与 c++ dll - 混合语言调试

发布于 2024-07-12 21:55:55 字数 464 浏览 12 评论 0原文

我有一个vb项目,它调用dll中的函数。 该dll是在一个单独的vs项目(portaudio)中创建的,该项目是用c编写的。

dll c 项目编译干净并构建所需的 dll,我目前将其放在 c:\windows\system 中以 vb 运行时可以看到它。

VB 项目位于 c:\devprojects\vbtest

C 项目位于 c:\devprojects\portaudio 中,项目文件位于 c:\devprojects\portaudio\build\msvc 中。 在此 msvc 目录下的 Win32\debug 中创建的 Dll。

当我调用dll函数时,vs调试器是否可以单步执行dll中的c函数 - 我有所有代码等,但我不知道VS2005是否支持这种混合语言调试。

如果可能的话,您能否建议我如何设置 Visual Studio 来实现这一目标。

非常感谢 大卫

I have a vb project which calls functions in a dll.
The dll is created in a separate vs project (portaudio), which is written in c.

The dll c project compiles clean and builds the required dll, which I am currently dropping in c:\windows\system to vb runtime can see it.

VB Project lives in c:\devprojects\vbtest

C Project lives in c:\devprojects\portaudio with the project file in c:\devprojects\portaudio\build\msvc. Dll created in Win32\debug under this msvc directory.

When I call the dll function, is it possible for the vs debugger to step through the c function in the dll - I have all the code etc, but I don't know if VS2005 supports this kind of mixed language debugging.

If this is possible, could you advise how I should set up my Visual Studio to achieve this.

Many thanks
David

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

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

发布评论

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

评论(3

趴在窗边数星星i 2024-07-19 21:55:56

使用这两个项目创建一个解决方案,使用“添加引用..”对话框 -> 将 VB 项目中的引用添加到 C 项目中 在调试模式下对它们进行项目和构建。

如何从 VB 调用 C dll?

Create a solution with both projects, add the reference in VB project to C project using 'Add Reference..' dialog -> Project and build them all in debug mode.

How do you calls C dll from VB?

寄离 2024-07-19 21:55:56

如果它是 VB.NET,那么这非常简单,只需设置一个包含两个项目的解决方案,设置它们的依赖关系,并确保在构建时 VB 项目的调试版本链接到从 C++ 项目生成的调试 lib/dll 。 Visual Studio 会完成剩下的工作。

我之前已经用 C# 应用程序调用 C++ dll 做过几次这样的事情。 我不打算设置这个,但尝试在调试时单步执行,假设我会得到程序集列表,并且至少可以找出我的代码出了什么问题......但是它加载了正确的 .cpp 文件并且允许我继续单步执行该代码。

If its VB.NET then this is very easy, just set up a solution with both projects under it, set up their dependencies and ensure that on build the debug version of the VB project links to the debug lib/dll produced from your C++ project. Visual Studio does the rest.

I've done this before a couple of times with C# applications calling a C++ dll. I didn't intend to set this up, but tried stepping through whilst debugging assuming I would get the assembly listing and could at least work out somethig of what was going wrong with my code... however it loaded the correct .cpp file and allowed me to continue stepping through that code.

婴鹅 2024-07-19 21:55:55

不必将两个项目都放在同一个解决方案中,但您应该在启用调试符号的情况下编译这两个项目。

现在,在 VB net 解决方案项目/属性中,在“调试”选项卡中确保选中“启用非托管代码调试”。

还要确保加载的 dll 位于编译的同一位置,否则可能找不到存储调试符号的 pdb。

It is not necessary to have both projects in the same solution, but you should compile both projects with debug symbols enabled.

Now in your VB net solution Project/Properties, in the Debug tab make sure that "Enable unmanaged code debugging" is checked.

Also make sure that the dll loaded is in the same place where it was compiled, else it may not found the pdb where the debug symbols are stored.

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