Next Up Previous Contents
Next: A.6.1 mixed-c.c
Up: A Example programs
Previous: A.5 crash.c
[ID index][Keyword index]

A.6 Mixed language programming

The files mixed-c.c and mixed-f.f illustrate some of the techniques involved in calling C from Fortran and vice versa, as described in Section 2.5.4.

On a Sun, compile and link them as follows:


f77 -c mixed-f.f -ext_names=plain
cc -c mixed-c.c
f77 -o mixed mixed-c.o mixed-f.o
The extra option to the first f77 command tells the compiler not to add an underscore to function names; different compilers will have different switches for accomplishing the same thing. See Section 2.5.4.3 for discussion.



Next Up Previous Contents
Next: A.6.1 mixed-c.c
Up: A Example programs
Previous: A.5 crash.c
[ID index][Keyword index]
Theory and Modelling Resources Cookbook
Starlink Cookbook 13
Norman Gray
2 December 2001. Release 2-5. Last updated 10 March 2003