title: Is there any way to simulate LD_LIBRARY_PATH in Windows?
body: <p>I have a program do so some graphics.  When I run it interactively, I want it to use OpenGL from the system to provide hardware accelerated graphics.  When I run it in batch, I want to be able to redirect it to use the Mesa GL library so that I can use OSMesa functionality to render to an offscreen buffer.  The OSMesa functionality is enabled by doing a LoadLibrary/GetProcAddress if the batch start up option is selected.</p>
  
  <p>On Linux, its fairly easy to make this work.  By using a wrapper script to invoke the program, I can do something like this:</p>
  
  <pre><code>if [ "$OPTION" = "batch" ]; then
    export LD_LIBRARY_PATH=$PATHTO/mesalibs:$LD_LIBRARY_PATH
  fi
  </code></pre>
  
  <p>It is possible to do something this in Windows?</p>
  
  <p>When I try adding a directory to the PATH variable, the program continues to go to the system opengl32.dll.  The only way I can get the program to use the Mesa GL/OSMesa shared libraries is to have them reside in the same directory as my program.  However, when I do that, the program will never use the system opengl32.dll.</p>