Difference between revisions of "Polyglot"
Jump to navigation
Jump to search
Line 13: | Line 13: | ||
Things to get right: | 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 | * matching the sizes of variables | ||
* pass by reference, pass by value | * pass by reference, pass by value | ||
* fortran indexes arrays from 1, by defualt; C from 0. | * fortran indexes arrays from 1, by defualt; C from 0. | ||
* The rows/columns are reversed from Fortran to C. | * The rows/columns are reversed from Fortran to C. |
Revision as of 16:55, 26 May 2008
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 from Fortran to C.