Difference between revisions of "Polyglot"

From SourceWiki
Jump to navigation Jump to search
 
Line 11: Line 11:
  
 
The first example is calling a Fortran routine from C.
 
The first example is calling a Fortran routine from C.
 +
 +
Things to get right:
 +
* 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.

Revision as of 16:26, 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:

  • 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.