Given an assembly with an entry point like:
int FooClass::doFoo(int x, double y)
{
int ret;
// Do some foo
return ret;
}
Is it possible to use yet another assembly to simulate something like:
int FooClass::doFoo(int x, double y)
{
int ret;
TRACE_PARAM_INT(x)
TRACE_PARAM_DOUBLE(y)
// Do some foo
TRACE_RETURN_INT(ret)
return ret;
}
And only enable this code injection when DEBUG is present. If there is such way, how do you load the "debugging" assembly?
EDIT 1: #ifdef is not an option. Say, I don't want to modify the code base.
EDIT 2: My main question is "How to INJECT code to an already compiled assembly". I do have the base code but I'd rather not add the K of lines for tracing in that main code but have another assembly that do such. I do know how to use VS to debug, what I want to is add tracing mechanism of variables (among other things).