程序中調用LoadLibrary函數裝載一個DLL文件,沒有指定文件路徑,那麼Windows操作系統搜索DLL文件的順序如下:
1.The directory where the executable module for the current process is located.
進程的所在目錄
2.The current directory.
當前目錄
3.The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
Windows系統目錄
4.The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
Windows目錄
5.The directories listed in the PATH environment variable.
Path環境變量中的目錄
當一個DLL文件被裝入內存後,其他應用程序不必再重複裝入同名的DLL(不論要裝入的DLL存放在什麼位置)。