text: #include<iostream>
  #include<cstdio>
  #include "stub.h"
  #include "addr_any.h"
  
  using namespace std;
  
  static int foo()
  {
      printf("I am foo\n");
      return 0;
  }
  
  int foo_stub()
  {
      std::cout << "I am foo_stub" << std::endl;
      return 0;
  }
  
  int printf_stub(const char * format, ...)
  {
      std::cout<< "I am printf_stub" << std::endl;
      return 0;
  }
  
  int main(int argc, char **argv)
  {
  
      //Get application static function address
      {
          AddrAny any;
          
          std::map<std::string,void*> result;
          any.get_func_addr("foo", result);
          
          foo();
          Stub stub;
          std::map<std::string,void*>::iterator it;
          for (it=result.begin(); it!=result.end(); ++it)
          {
              stub.set(it->second ,foo_stub);
              std::cout << it->first << " => " << it->second << std::endl;
          }
          foo();  
      
      }
      //Get dynamic library static function address
      {
          AddrAny any;
          
          std::map<std::string,void*> result;
          any.get_func_addr("printf", result);
  
          
          foo();
          Stub stub;
          std::map<std::string,void*>::iterator it;
          for (it=result.begin(); it!=result.end(); ++it)
          {
              stub.set(it->second ,printf_stub);
              std::cout << it->first << " => " << it->second << std::endl;
          }
          foo();
      }
      return 0;
  
  }
  
  
  