Hi, so I'm using Visual Studio 2005 and for my current project I'm building a C# Add-In to handle the weaving of aspects for AspectC++. It's simple enough to gather the aspect and source files and feed them into the aspect compiler, but this generates new (modified) source files. I'm trying to emulate the standard AspectC++ Add-In: http://www.pure-systems.com/AspectC_Add-In.22+M54a708de802.0.html, so I'd like to leave the source files for the project unchanged as I feed in the woven files to the C++ compiler. Assuming I can even do this (not sure how), how would I get the debugger to point correctly to the original source files? I know that I'll have to uncheck the VS option so the source doesn't have to match the compiled version, but I'm at a loss for how to associate the two without modifying the source files directly. Any advice?
views:
318answers:
1It sounds like you want to modify the source code just before or after the preprocessor. In this case you should use the #line directive, to tell the compiler what file and line it is really processing. This is how the preprocessor works, it includes all your header files into one massive file, this file contains #line directives, which enables the compiler to report errors for the correct line and specify the correct line in the symbols for the the debugger.
You should try just running the preprocessor on a source file. This will show you how the #line directive works. The cl.exe command line option /P will help you here. Remember you will require all the other preprocessor options like /D and /I required to compile the file for this to work.
http://msdn.microsoft.com/en-us/library/b5w2czay(VS.71).aspx