程序的对dll的搜索顺序如下: The directory from which the application loaded. The current directory. The system directory. Use the GetSystemDirectory function to get the path of this directory. The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
我用资源管理器打开我的应用程序(myExe.exe)所在的目录(d:\myprj),双击myExe.exe,这时程序不能正常运行;但是如果我用命令行工具cmd进入到dos模式下,用命令:
d:\myPrj>myExe.exe
启动我的应用程序,奇怪的事情发生了,我的应用程序这时居然可以正常运行了!!!晕
我的这个程序是需要一些dll才能运行的,如果我把d:\myPrj\目录下的dll文件删除,
在dos命令下用:
d:\myprj> myExe.exe
也可以正常启动我的myExe.exe并正常运行。问题是dos模式下怎么找到我的那些dll文件的?例如mydll1.dll位于c:\winnt\system32下。
DOS环境的默认环境参数是多少?
The directory from which the application loaded.
The current directory.
The system directory. Use the GetSystemDirectory function to get the path of this directory.
The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.