Fotran loading of a dynamic library

Hello, i’m looking for a mechanism in fortran (I’m using pgf90) that allow me to load at runtime a dynamic library like when using dlopen in C or LoadLibrary (in WIN32).

Any suggestions ?

Etienne Perchat

Hi Etienne,

Although Fortran doesn’t have the ability to load a dynamic library directly, you should be able to call the C functions. With pre-7.0 PGI compilers, you’ll need to write an interface function in C to perform the actual call. With the up-coming 7.0 release, we will support F2003 ISO_C_BINDING so you will be able to directly call the C function. Granted, I have not tried this myself so not 100% sure this will work, but it should.

  • Mat