Archived

This topic is now archived and is closed to further replies.

Debuggin DLLs

This topic is 5576 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How to debug a DLL project? When I tried it asks me for an .exe Thus, I created an .exe using the dll to test it, but it doesn't work. [edited by - vbisme on September 11, 2002 11:11:08 PM]

Share this post


Link to post
Share on other sites
Your question was a little confusing but I will just go on faith that after creating the dll project it still wasn't working.

The dll is just a library - which means it supplies and executable with additional code that is accessed via functions, or methods depending on if you are using C++ or C and how you are exporting your calls. This is probably old hat but I just wanted to provide a complete answer.

When you are asked for an .exe when debugging the dll, it is assuming that you are going to provide an executable that will use the code in the dll. So, you need to make sure the .exe makes use of the code.

Next, ensure that the dll AND the executable are debug code, otherwise the debugger will have problems tracing into the code, thus making your experience less enjoyable.

Next, depending on HOW you created the exe and where it expects to load the dll, you will need to take special care that you are working with the latest code in the library. This can often become a VERY frustrating problem. However, you can change code on the fly (with some caveats) while debugging so it's sort of a wash. If you make the library project a dependency of the exe - then this process can be made a little easier but you still need to keep your eyes open.


Good Luck - If this doesn't cover it, there are some good articles on MSDN and Dr. Dobbs that cover this topic that may be helpful.

Dan-0


[edited by - xiuhcoatl on September 11, 2002 10:43:16 PM]

Share this post


Link to post
Share on other sites
Create an EXE program that makes use of the DLL you want to debug.

In VB, this means that you must make another project, a Standard EXE, (preferably in the same ProjectGroup), and make sure that EXE fully tests the functionality of the DLL.

In MSVC++, make two projects in the same workspace. MSVC might complain if you create the DLL before the Win32 Exe, so make the EXE project first.

Hope this helps!

Share this post


Link to post
Share on other sites
speaking from a VS.Net point of view to work on debugging dlls I have the following setup :

overall solution with :

(a) test exe - set to debug build mode
(b) dll i need to debug - set to debug build mode
(c) a dll in release mode

I execute the program (a) in debug mode, that way when.. errm if ( ) it crashes the debugger can jump into either the DLL or the EXE (i even have break points set inside the DLL which work perfectly)

I assume under VS6 you do the same thing, the terminlogy is just different, butmake sure your test exe and dll are in debug mode and you run them in debug mode as well

Share this post


Link to post
Share on other sites