title: C++ hook function of compiled library for debugging
body: <p>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).</p>
  
  <p>Consider this function in compiled library</p>
  
  <pre><code>class SomeClass
  {
  public:
      static QString getUpper(const QString &amp;str);
  };
  </code></pre>
  
  <p>Program that includes this SomeClass from library</p>
  
  <pre><code>void printArguments(const QString &amp;str)
  {
      qDebug() &lt;&lt; str; //here we print argument
  }
  
  int main()
  {
      //function that I need
      hookFunction((void*)&amp;SomeClass::getUpper, (void*)&amp;printArguments);
      SomeClass::getUpper("Hi"); // here I will see "Hi" in console
  }
  </code></pre>
  
  <p>I have found some <a href="https://stackoverflow.com/questions/29093398/win32-how-can-i-hook-functions-in-compiled-programs-with-c">similar question</a>, but I don`t need dll injection. This is my program that include library.</p>