Polyglot
Mixing Languages
Introduction
Languages have their pros and cons.
svn export http://source.ggy.bris.ac.uk/subversion-open/polyglot/trunk ./polyglot
The first example is calling a Fortran routine from C.
Things to get right:
- use 'nm' or a similar program to investigate the name mangling used by your Fortran compiler, so that you can match the name in your C program.
- matching the sizes of variables
- pass by reference, pass by value
- fortran indexes arrays from 1, by defualt; C from 0.
- The rows/columns are reversed for 2-dimensional arrays in Fortran to C. Arrays in C are 'row-major' and arrays in Fortran are 'column major'.