October 21, 2009

DLL (Dynamic-Link Library) Search Order

Are you sure that your program loads the DLLs expected? You may want to check the search order for loading the proper DLLs.

Standard Search Order (SafeDllSearchMode is enabled)
1. The directory from which the application loaded.
2. The system directory. Use the GetSystemDirectory function to get the path of this directory.
3. The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
4. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
5. The current directory.
6. The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key. The App Paths key is not used when computing the DLL search path.

More Detail Information
Dynamic-Link Library Search Order