c++_calls_c_test a C++ code which illustrates how a C++ code can call a C function.
For this example, the KRONROD package is used. Note that the KRONROD library is available in C++ and in C, 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 C function from a C++ function, there are some simple things that may be enough to guarantee success.
extern "C" { void kronrod ( int n, double eps, double x[], double w1[], double w2[] ); void timestamp ( ); }
The computer code and data files described and made available on this web page are distributed under the MIT license
c++_calls_c_test is available in a C++ version and a FORTRAN90 version and a MATLAB version.
c++_calls_f77_test, C++ codes which call a FORTRAN77 subroutine.
c++_calls_f90_test, C++ codes which call a FORTRAN90 subroutine.
KRONROD, a C library which can compute a Gauss and Gauss-Kronrod pair of quadrature rules of arbitrary order, by Robert Piessens, Maria Branders.
KRONROD, a C++ code which can compute a Gauss and Gauss-Kronrod pair of quadrature rules of arbitrary order, by Robert Piessens, Maria Branders.
MIXED, C++ codes which call a function written in another programming language.