Language mixing - COMMON


The linkage convention requires that we use the name event_ to reference COMMON/EVENT/

This also serves as an example of differences in array indexing between C/C++ and FORTRAN.


/*

A C++ program which demonstrates calling of FORTRAN code.

The struct event_ is used to map on to COMMON/EVENT/
which is declared and initialised in the FORTRAN
subroutine inievt().

*/

#include <stdio.h>

extern "C"
{
void vadd_( const float [], const float [], float [],
            const unsigned & );
void inievt_( void );
}

struct
{
   float XYZ[1000][3];
   float PXYZ[1000][3];
} event_;


cont...