Accessing Common Blocks Directly

You can access Fortran common blocks directly by defining a structure with the appropriate fields and then declaring the structure as an external data symbol. For example, the following code defines a structure named CBLOCK, which the C code can use to directly access items in the Fortran common block named CBLOCK:

struct block_type
{
    int    n;
    double x;
    double y;
};

extern struct block_type CBLOCK;