S
Somebody
Given this class:
class A
{
public:
int Test()
{
return 0;
}
int Test(int a)
{
return 1;
}
};
how can I get the following code to work?
LPVOID lpv = (LPVOID&)A::Test;
If I comment out the 2nd overloaded Test(int) function, this compiles just
fine and does whats expected. If I leave Test(int) in the code, the compiler
actually ** CRASHES ** with an internal compiler error (Visual Studio 2008).
Obviously the issue here is how do I differentiate between the two functions
when I am trying to get the pointer to the function?
Please note, I CAN NOT rename either of the functions and I CAN NOT add
another function which wraps the overloaded function in a derived class as I
** MUST ** have the exact address of the A::Test(int) function for hooking
purposes.
class A
{
public:
int Test()
{
return 0;
}
int Test(int a)
{
return 1;
}
};
how can I get the following code to work?
LPVOID lpv = (LPVOID&)A::Test;
If I comment out the 2nd overloaded Test(int) function, this compiles just
fine and does whats expected. If I leave Test(int) in the code, the compiler
actually ** CRASHES ** with an internal compiler error (Visual Studio 2008).
Obviously the issue here is how do I differentiate between the two functions
when I am trying to get the pointer to the function?
Please note, I CAN NOT rename either of the functions and I CAN NOT add
another function which wraps the overloaded function in a derived class as I
** MUST ** have the exact address of the A::Test(int) function for hooking
purposes.