Note: this article assumes you're using Microsoft Visual Studio 2002/2003/2005. For other development environments the priniciples stay the same, but the option names will differ.
When developing WME plugins, you'll probably want to use the C debugger to see what's happening inside your code. Since plugins are basically just ordinary DLL libraries, the generic DLL debugging guidelines apply here, with some further steps necessary.
Firstly, you'll need a WME project to test your plugin with. Creating a WME project is pretty straightforward and you should probably know how to do it. After preparing the project, shut down ProjectMan. It's necessary, because ProjectMan loads the plugins as well, and it would keep your DLL locked for writing, making it impossible to recompile.
You will need to change the settings of your Visual Studio project. If you used the sample plugin project supplied with WME development kit, your project should already contain a post-build step, which copies the compiled DLL to WME directory. That way everytime you run any WME game, it will automatically load your plugin (WME loads all plugins present in the same directory where wme.exe is located).
Now we want to force Visual Studio to run WME when we click “Start”, so that the debugger is automatically attached to the WME process (and hence to our DLL we want to debug). To do so, go to the Solution Explorer tab, right-click your project name and select “Properties” (be sure to edit the Debug configuration). A project properties window will pop up. In the left list select Debugging. On the right side you need to fill the Command and Command Arguments properties:
Command
Fill in the path to wme.exe, typically "c:\Program Files\WME DevKit\wme.exe".
Command Arguments
Fill in -project “path_to_your_wme_project.wpr”, for example:
-project "c:\Program Files\WME DevKit\projects\wme_demo\wme_demo.wpr"
Don't forget to enclose the project file path in quotes, especially if it contains spaces.
And that's it. Next time you run your project using the “Start” ( “Start debugging” in VS2005) command (or by pressing F5) Visual Studio will run WME, WME will load your DLL and the testing project, and the debugger will be attached so that you can use breakpoints and all the other goodies the VS debugger provides.
Visual Studio will warn you that wme.exe doesn't contain any debugging information, but it's ok because you don't want to debug wme.exe but your DLL.
Note: You must be running the game in windowed mode. Full-screen mode is unsuitable for debugging, because the debugger would stay hidden behind the game window.