471,055 Members | 1,989 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,055 software developers and data experts.

Debug Win32 DLL from C# Client

I'm trying to setup a test jig where I can call an exported standard
Win32 dll from a C# exe. The program I am writing for requires a
standard Win32 dll but I want to initially test/debug the dll from a
C# client, if possible.

How can I set up Visual Studio (7.1) so that I can step the debugger
into the dll code from the C# code. Or as a minimum how can I break
in the dll code.

Now when I try to step into the dll function from c# it just steps
over it and it ignores any break points in the dll.

thanks
bill
Nov 16 '05 #1
6 8878
Bill,

Have you added the C++ code as a separate project in the solution?
Also, is that project configured for a debug build? Finally, is the C++
code configured to run and wait for a program to load it?

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Bill Jones" <bi*******@worldnet.com> wrote in message
news:uk********************************@4ax.com...
I'm trying to setup a test jig where I can call an exported standard
Win32 dll from a C# exe. The program I am writing for requires a
standard Win32 dll but I want to initially test/debug the dll from a
C# client, if possible.

How can I set up Visual Studio (7.1) so that I can step the debugger
into the dll code from the C# code. Or as a minimum how can I break
in the dll code.

Now when I try to step into the dll function from c# it just steps
over it and it ignores any break points in the dll.

thanks
bill

Nov 16 '05 #2
Try this

Open project settings.

Go to Configuration Properties->Debugging

Set "Enable Unmanaged Debugging" to "True"

Shak.
"Bill Jones" <bi*******@worldnet.com> wrote in message
news:uk********************************@4ax.com...
I'm trying to setup a test jig where I can call an exported standard
Win32 dll from a C# exe. The program I am writing for requires a
standard Win32 dll but I want to initially test/debug the dll from a
C# client, if possible.

How can I set up Visual Studio (7.1) so that I can step the debugger
into the dll code from the C# code. Or as a minimum how can I break
in the dll code.

Now when I try to step into the dll function from c# it just steps
over it and it ignores any break points in the dll.

thanks
bill

Nov 16 '05 #3

I set Enable Unmanaged Debugging to True. (as suggest by Shakir).
Still can't step into the dll.
Have you added the C++ code as a separate project in the solution?
Yes. I have a solution named TestDLLSol which holds projects TestDll1
and TestDLL1ClientCSharp.
Also, is that project configured for a debug build?
Yes, both.
Finally, is the C++ code configured to run and wait for a program to load it?


How do I do this?
Also, I copied TestDll1.dll into TestDLL1ClientCSharp\bin\Debug and I
set TestDLL1ClientCSharp as the Startup project.
thanks,
bill

Nov 16 '05 #4
Alright Bill,

Try this definition for ur dll import. Make sure that you specify the full
path where the .pdb file is located. Now it shld debug after enabling the
project settings.

for example.

[DllImport(c:\test directory\test program\mydll.dll")]
public static extern TestFunction(blah, blah)

Shak.
"Bill Jones" <bi*******@worldnet.com> wrote in message
news:k8********************************@4ax.com...

I set Enable Unmanaged Debugging to True. (as suggest by Shakir).
Still can't step into the dll.
Have you added the C++ code as a separate project in the solution?
Yes. I have a solution named TestDLLSol which holds projects TestDll1
and TestDLL1ClientCSharp.
Also, is that project configured for a debug build?


Yes, both.
Finally, is the C++ code configured to run and wait for a program to load

it?
How do I do this?
Also, I copied TestDll1.dll into TestDLL1ClientCSharp\bin\Debug and I
set TestDLL1ClientCSharp as the Startup project.
thanks,
bill

Nov 16 '05 #5

Bingo, that got it. It looks like the full path was the trick. Thank
you very much Mr. Shakir Huss.
Alright Bill,

Try this definition for ur dll import. Make sure that you specify the full
path where the .pdb file is located. Now it shld debug after enabling the
project settings.

for example.

[DllImport(c:\test directory\test program\mydll.dll")]
public static extern TestFunction(blah, blah)

Shak.
"Bill Jones" <bi*******@worldnet.com> wrote in message
news:k8********************************@4ax.com.. .

I set Enable Unmanaged Debugging to True. (as suggest by Shakir).
Still can't step into the dll.
>Have you added the C++ code as a separate project in the solution?


Yes. I have a solution named TestDLLSol which holds projects TestDll1
and TestDLL1ClientCSharp.
>Also, is that project configured for a debug build?


Yes, both.
>Finally, is the C++ code configured to run and wait for a program to load

it?

How do I do this?
Also, I copied TestDll1.dll into TestDLL1ClientCSharp\bin\Debug and I
set TestDLL1ClientCSharp as the Startup project.
thanks,
bill


Nov 16 '05 #6
Anytime Bill.

Shak.

"Bill Jones" <bi*******@worldnet.com> wrote in message
news:13********************************@4ax.com...

Bingo, that got it. It looks like the full path was the trick. Thank
you very much Mr. Shakir Huss.
Alright Bill,

Try this definition for ur dll import. Make sure that you specify the fullpath where the .pdb file is located. Now it shld debug after enabling the
project settings.

for example.

[DllImport(c:\test directory\test program\mydll.dll")]
public static extern TestFunction(blah, blah)

Shak.
"Bill Jones" <bi*******@worldnet.com> wrote in message
news:k8********************************@4ax.com.. .

I set Enable Unmanaged Debugging to True. (as suggest by Shakir).
Still can't step into the dll.

>Have you added the C++ code as a separate project in the solution?

Yes. I have a solution named TestDLLSol which holds projects TestDll1
and TestDLL1ClientCSharp.

>Also, is that project configured for a debug build?

Yes, both.

>Finally, is the C++ code configured to run and wait for a program to
loadit?

How do I do this?
Also, I copied TestDll1.dll into TestDLL1ClientCSharp\bin\Debug and I
set TestDLL1ClientCSharp as the Startup project.
thanks,
bill

Nov 16 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by David++ | last post: by
10 posts views Thread by Brett | last post: by
7 posts views Thread by Sunil Varma | last post: by
7 posts views Thread by Bart Roozendaal | last post: by
6 posts views Thread by Andrew Rowley | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.