Tao.Platform.Windows SDK Documentation

Kernel.SetDllDirectory Method 

The SetDllDirectory function modifies the search path used to locate DLLs for the application.

[Visual Basic]
Public Shared Function SetDllDirectory( _
   ByVal pathName As String _
) As Boolean
[C#]
public static bool SetDllDirectory(
   string pathName
);

Parameters

pathName
Pointer to a null-terminated string that specifies the directories to be added to the search path, separated by semicolons. If this parameter is NULL, the default search path is used.

Return Value

If the function succeeds, the return value is true.

If the function fails, the return value is false. To get extended error information, call GetLastWin32Error.

Remarks

The SetDllDirectory function affects all subsequent calls to the LoadLibrary and LoadLibraryEx functions. After calling SetDllDirectory, the DLL search path is:

  1. The directory from which the application loaded.
  2. The directory specified by the pathName parameter.
  3. The system directory. Use the GetSystemDirectory function to get the path of this directory. The name of this directory is System32.
  4. The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is System.
  5. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
  6. The directories that are listed in the PATH environment variable.

To revert to the default search path used by LoadLibrary and LoadLibraryEx, call SetDllDirectory with NULL.

See Also

Kernel Class | Tao.Platform.Windows Namespace | GetDllDirectory | GetSystemDirectory | GetWindowsDirectory | LoadLibrary