Reputation: 603
For debugging purposes in want to get arguments of some function in compiled library on each call. I know I could recompile library, but it could take half of day for some libraries(Qt for example).
Consider this function in compiled library
class SomeClass
{
public:
static QString getUpper(const QString &str);
};
Program that includes this SomeClass from library
void printArguments(const QString &str)
{
qDebug() << str; //here we print argument
}
int main()
{
//function that I need
hookFunction((void*)&SomeClass::getUpper, (void*)&printArguments);
SomeClass::getUpper("Hi"); // here I will see "Hi" in console
}
I have found some similar question, but I don`t need dll injection. This is my program that include library.
Upvotes: 1
Views: 1623