c_calls_f90


c_calls_f90, C codes which illustrates how a C main program can call a FORTRAN90 subroutine.

For this example, the KRONROD package is used. Note that the KRONROD library is available in C and in FORTRAN90, so this example is not created out of necessity (the C main program could have simply called the C version of KRONROD). Instead, it is intended as an example of how to do this when you have to (you don't have a C version of the routines you want to use.)

When calling a FORTRAN90 routine from a C function, there are some simple things that may be enough to guarantee success.

Licensing:

The computer code and data files described and made available on this web page are distributed under the MIT license

Languages:

c_calls_f90 is available in a C version and a C++ version and a MATLAB version.

Related Data and Programs:

C_CALLS_F77, is a directory of C codes which illustrates how a C code can call a FORTRAN77 subroutine.

C++_CALLS_F77, C++ programs which illustrate how a C++ main program can call a FORTRAN77 subroutine.

C++_CALLS_F90, C++ programs which illustrate how a C++ main program can call a FORTRAN90 subroutine.

F77_CALLS_C, FORTRAN77 programs which illustrates how a FORTRAN77 program can call a C function.

F77_CALLS_C++, FORTRAN77 programs which illustrates how a FORTRAN77 program can call a C++ function.

F90_CALLS_C, FORTRAN90 programs which illustrates how a FORTRAN90 program can call a C function.

F90_CALLS_C++, FORTRAN90 programs which illustrates how a FORTRAN90 program can call a C++ function.

KRONROD, a C code which can compute a Gauss and Gauss-Kronrod pair of quadrature rules of arbitrary order, by Robert Piessens, Maria Branders.

KRONROD, a FORTRAN90 library which can compute a Gauss and Gauss-Kronrod pair of quadrature rules of arbitrary order, by Robert Piessens, Maria Branders.

MATLAB_CALLS_C, MATLAB programs which call a C function, using MATLAB's MEX facility.

MIXED, C codes which call a function written in another programming language.

Reference:

Source Code:

KRONROD is the FORTRAN90 source code for the KRONROD library. It should be essentially unchanged from the standard version.

KRONROD_test is the C source code for the main program. Some changes have been made from the standard version in order to adjust for the fact that we are calling a FORTRAN90 subroutine.

Examples and Tests:


Last revised on 06 December 2010.