Blane John
Blane John

Reputation: 65

How to set dll search path in Fortran?

is there a way to set the external dll searching path when a Fortran project is deployed(Leave the PATH strategy aside)? Assume that we have a Main.exe here, and it depend on an external dll called Depend.dll. Generally, we can put Main.exe and Depend.dll together under the same folder to make it work, but in another situation, if Depend.dll is under a folder called External, and External and Main.exe are put together, is there a solution that Main.exe can find the dll?

Upvotes: 0

Views: 225

Answers (1)

albert
albert

Reputation: 9057

As discussed, for Windows:

  • add the place of the dll to the PATH variable.

In case one wants to only set the path to the dll temporarily:

  • create a .bat file with:
    • save current path: set SAVED_PATH=%PATH%
    • set path including dll directory: set PATH=<path to dll>;%PATH%
    • <run executable>
    • reset path: set PATH=%SAVED_PATH%

Upvotes: 2

Related Questions