linking fortran DLL directory paths to c binary at runtime

I am compiling a C program using the pgicc wrapper and linking a fortran object when building the executable. However, at runtime, the binary does not recognize the location of the *.so files linked during the building of the execuatable. How do I specify this location so that the library fortran path is recognized at runtime?

Hi Stockerr,

You mention both DLL and .so so I’m not sure if you’re on Windows or Linux. Also, I’m not sure what the “pgicc wrapper” is? Do you mean the pgcc (no i) driver? Finally, I’m sure which so libraries you mean, the PGI Fortran runtime or your own .so?

On Linux, you need to set the environment variable “LD_LIBRARY_PATH” to include path to the location of the .so libraries. Though, if you’re running on the same system you built your program on, the default paths are embedded in your binary so you shouldn’t need to set LD_LIBRARY_PATH. Hint: use “ldd myprogram.out” to see which .so the program need and the location where the loader thinks they are located.

On Windows, the location of your DLLs must be in your PATH environment variable. Though, the default on Windows is for the PGI runtime to be statically linked (unless you linked with -Bdynamic).

Hopefully this helped, but if not please let me know.

  • Mat