Buddha said that there is a cause and effect in everything.
# Cause
Recently I am writing a desktop application. I want to organize a folder structure of main application, plugins, and other dependencies, so I need to know the DLL search sequence of windows.
I don't understand Mac or Linux. Let's talk about it later.
# General search order
In general, Windows searches for DLL in the following order:
The Directory of the executable module of the current process.
Current directory.
Windows directory.GetsystemdirectoryThe function retrieves the path of this directory.
Windows directory.GetwindowsdirectoryThe function retrieves the path of this directory.
Directory listed in the PATH environment variable.
# Safe DLL Search Mode
There is also a Safe DLL Search Mode in the window statement, which will affect the search sequence.
You can enable or disable the Registry by using the create registry option:
HKLM \ System \ CurrentControlSet \ Control \ Session Manager \ SafeDllSearchMode
There is an article dynamic-link library search order on msdn, which provides a detailed explanation of this issue. You can take a good look when you have time or questions in the future.
# Reference
[Dynamic-link library search order] (http://msdn.microsoft.com/en-us/library/ms682586%28VS.85%29.aspx)