Skip to content

Linking external libraries

ShatrovOA edited this page Feb 17, 2020 · 4 revisions

To link external libraries two main approach can be used

  • directly link libraries with their full path;
  • relative link libraries extending the linker search-paths.

Direct linking of libraries with full path

The linking of external libraries directly using their full path is simply accomplished by

FoBiS.py build -libs /strange_path_to/foo.a

Relative linking of libraries extending linker search paths

The linking of external libraries extending the linker search paths is simply accomplished by

FoBiS.py build -ext_libs foo --lib_dir /strange_path_to/my_libraries/

Note on the linking libraries that include Fortran modules

When the external libraries contain one or more Fortran modules the module files .mod must be passed to the compiler during the compile phase. To this aim the directories where the module files are contained must be added to the included directories list by

FoBiS.py build --include  /stange_path_to/my_libraries/mod/

Note on the fobos options and examples

All the above CLA switches are available as fobos options (as well as all other FoBiS.py CLAs). Presently, the two approaches above described are implemented into the two examples relative to the cumbersome program.

Direct linking Relative linking
direct linkin of cumbersome dependency program relative linkin of cumbersome dependency program
Clone this wiki locally