September 2018
Intermediate to advanced
606 pages
14h 32m
English
The code sample for this recipe is in Fortran and C, setting the stage for Chapter 9, Mixed-language Projects, where mixed-language programming will be discussed. The main program is a simple Fortran executable that calls a C function, print_info(), which will print the configuration information. It is worth noting that with Fortran 2003, the compiler will take care of name mangling (given a proper interface declaration of the C function), as seen in the simple example.f90 source file that we will use:
program hello_world implicit none interface subroutine print_info() bind(c, name="print_info") end subroutine end interface call print_info()end program
The print_info() C function is defined in the template file, print_info.c.in ...
Read now
Unlock full access