Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are a few ways you could handle this, depending on the libraries and their names/locations:</p> <p>If both have the same name (opengl32.dll), then you need to add the Mesa DLL location to the search path such that it is searched <em>before</em> the system directory. The order directories are checked in is detailed <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms682586%28v=vs.85%29.aspx#search_order_for_desktop_applications" rel="nofollow">here</a>. As you can see, <code>$PATH</code> comes last, after system, so you can't just add the directory to that. However, you can make use of the second step ("The current directory") by setting the working directory to a path containing the mesa files. Generally this means starting the application using an absolute path while in the directory containing the files.</p> <p>That's still not particularly pleasant, though. If you can, you should use <code>LoadLibrary</code> and check for an environment variable (<code>OPENGL_LIBRARY_PATH</code>) when your app starts up. Assuming the exports from <code>opengl32.dll</code> and Mesa's DLL are the same, you can do something like:</p> <pre><code>void LoadExports() { char location[MAX_PATH]; getenv("OPENGL_LIBRARY_PATH", location); HMODULE oglLib = LoadLibrary(location); function1 = GetProcAddress(oglLib, "glVertex2f"); ... } </code></pre> <p>This will work perfectly fine, doing almost exactly what you want.</p> <p>However, if you want to do that, you can't import <code>opengl32.dll</code>, which you're probably doing, you have to dynamically link throughout. Make sure not to link against <code>opengl32.lib</code> and you should be fine. Depending on how many functions you use, it may be a pain to set up, but the code can easily be scripted and only needs done once, you can also use <code>static</code> variables to cache the results for the lifetime of the program. It's also possible to use different function names for different libraries, although that takes a bit more logic, so I'll leave the details to you.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload