Lesson of 18 February 2011

Example of linking with foreign language (and decoration)

A Fortran routine making simple addition

File add.f

A simple C++ code with use external routine

File testDecoration.cc

The C decoration A simple code which use an external printOnTerminal C routine

File testDecoration2.cc

A C code which define _Z15printOnTerminalPKc. The code link (on GNU compiler) because the name fit the decoration of C++:

File testDecoration2b.c

Another example of Fortran linking A simple code which use an external print Fortran routine

File testFortranLink.cc

The fortran routine for which a parameter is a variable length string:

File print.f