title: Get functions names in a shared library programmatically
body: <p>Can I get list of all functions names from a shared library (Linux only) programmatically when I am using <code>dl_open()</code>?</p>
  
  <p>I want something like this:</p>
  
  <pre><code>std::vector&lt;std::string&gt; list_all_functions(void *dl) { 
     //... what can I do here?
  }
  
  int main() {
      void * dl = dl_open("./mylib.so", RTLD_NOW);
      auto functions = list_all_functions(dl);
      //...
      dl_close(dl);
      return 0;
  }
  </code></pre>
  
  <hr>
  
  <p>Example library (mylib.so)</p>
  
  <p>Header (.h):</p>
  
  <pre><code>extern "C" {
      int sum (int a, int b);
  }
  </code></pre>
  
  <p>Source (.c):</p>
  
  <pre><code>int sum (int a, int b) { return a + b; }
  </code></pre>
  
  <hr>
  
  <p>Dirty hack that I know: use <code>nm</code> or <code>objdump</code> utility </p>