title: Linux function redirect
body: <p>Hey, I'm trying to wrap a function in my program without using LD_PRELOAD.</p>
  
  <p>I have two functions with the same signature:</p>
  
  <pre><code>void someFunc () {
      puts ("someFunc");
  }
  
  void someFunc_wrapper () {
      puts ("someFunc_wrapper");
  }
  </code></pre>
  
  <p>And I want to redirect any function call to someFunc with a call to the wrapper function.
  Of course I could do that with defining macros or put the wrapper function into a shared library and then call the program like this:</p>
  
  <pre><code>LD_PRELOAD=./mylib.so my_program
  </code></pre>
  
  <p>However, I want to redirect the function calls at runtime, without modifying the program call.<br />
  As I understand, it should be possible to redirect these calls by modifying the executable's symbol table at runtime.</p>
  
  <p>Any help will be appreciated :)</p>