title: How to load a dynamic library on demand from a C++ function/Qt method
body: <p>I have dynamic library created as follows </p>
  
  <p>cat myfile.cc</p>
  
  <pre><code>struct Tcl_Interp;
  extern "C" int My_Init(Tcl_Interp *) { return 0; }
  </code></pre>
  
  <p>1) complile the cc file </p>
  
  <pre><code>g++ -fPIC -c myfile.cc
  </code></pre>
  
  <p>2) Creating a shared library </p>
  
  <pre><code>g++ -static-libstdc++ -static-libgcc -shared -o libmy.so myfile.o -L/tools/linux64/qt-4.6.0/lib -lQtCore -lQtGui
  </code></pre>
  
  <p>3) load the library from a TCL proc
  then I give command </p>
  
  <p>tclsh
  and given command 
  % load libmy.so </p>
  
  <p>is there any C++ function/ Qt equivalent to load that can load the shared library on demand from another C++ function.</p>
  
  <p>My requirement is to load the dynamic library on run time inside the function and then use the qt functions directly</p>
  
  <p>1) load the qt shared libraries (for lib1.so)
  2) call directly the functions without any call for resolve </p>
  
  <p>For example we have dopen, but for that for each function call we have to call dsym. My requirement is only call for shared library then directly call those functions.</p>