Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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?

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top