Click here to Skip to main content
15,886,783 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I'm creating an application using C++ and MFC. My app loads several MFC extension DLL from its "Plugins" folder during execution, and the user can choose which one he wants to launch in a list.
However, if someone wants to make a MFC extension DLL for my app, and only have the executable (not the source code), how can this person debug its MFC extension DLL?

What I have tried:

I tried to follow this procedure:
In Solution Explorer, select the DLL project.
From the View menu, choose Property Pages.
In the <Project> Property Pages dialog box, in the Configuration drop-down list box, choose Debug.
Open the Configuration Properties folder and select the Debugging category.
In the Command box, click the drop down arrow and choose Browse from the list to browse for the application.
Enter any necessary program arguments in the Command Arguments box.


from microsoft website. I also added my .dll in the "Plugins" folder of my app.
But it didn't work, and my app couldn't load any plugin from its folder.
Posted
Updated 28-Sep-17 5:11am

1 solution

You have to supply them a debug version of your executable because MFC can't mix debug and release mode modules. You don't have to supply them your source code though and I am not sure whether you have to supply them a symbol file, the .pdb. They have to make a debug build and specify command, arguments, and working directory in the debugging section of the configuration properties then they can set breakpoints in the interface methods and debug their library.

You can test this yourself by making a little skeleton library with all of the required interface methods and see if it works. It should be fairly simple. You will have to experiment to see what the extension library needs from your app in terms of .pdb files and such.
 
Share this answer
 
Comments
SheepSpeech 29-Sep-17 4:05am    
Hi,

I think it is what I've done (did I forget something? May be the .pdb files but I wasn't explicitly blocked without it).
The problem is more into this: my app loads plugins from its "Plugins" directory and then the user can choose one of them and launch it. So only attaching my extension to the app do not allow me to see the plugin in my app. Moreover, doing this way, my app doesn't load any plugin (usually, it loads all the plugins available in its "Plugins" directory).
Rick York 29-Sep-17 10:29am    
I will admit that it can get tricky but I have done exactly this myself in the past so I know it's possible. You can debug the DLLs in two ways. One is set a breakpoint in your code where you invoke functions from the DLL and then step into the code that it calls. The second is to set a breakpoint inside the functions of the DLL and then run the program until one of those breakpoints is hit. Either way is fairly simple. Give one or both a try and see what happens.
SheepSpeech 29-Sep-17 10:36am    
Did you try this without the main app's source code? Thanks.
Rick York 29-Sep-17 16:07pm    
Not that I recall. Have you? It's a quick and easy thing to do. I described how earlier.
SheepSpeech 2-Oct-17 4:49am    
This is what I understand:

"One is set a breakpoint in your code where you invoke functions from the DLL and then step into the code that it calls." You need to have the main app's source code for this.

"The second is to set a breakpoint inside the functions of the DLL and then run the program until one of those breakpoints is hit." You need to be able to run the debugguer from the DLL, to do this you have to attach the DLL to the app, but as I explained the app doesn't launch it in this case because it's not in its Plugins directory. If you also put the .dll in its Plugins directory and choose to launch it from the app, breakpoints are ignored.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900