title: Load multiple copies of a shared library
body: <p>I am running Linux, and I would like to be able to make parallel function calls into a shared library (.so) which is unfortunately not threadsafe (I am guessing it has global datastructures).</p>
  
  <p>For performance reasons, I do not want to simply wrap the function calls in a mutex.</p>
  
  <p>What I would like to do is to spawn, say 4 threads, and also load 4 copies of the same library into the process memory. Each thread then makes the function calls into its own copy of the library. </p>
  
  <p>Unfortunately, dlopen does not allow me to load more one instance of any library.</p>
  
  <p>Does anyone know of any method which will allow me to load the library more than once? (Other than making 4 copies of the .so file, each with a different name)</p>