$ cc/object=zz sys$input
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <descrip.h>

void testi1(int i)
{
   printf("i=%d\n",i);
   return;
}

void testi2(int *i)
{
   printf("i=%d\n",*i);
   return;
}

int globi;

void testi3()
{
   printf("i=%d\n",globi);
   return;
}

void testx1(float x)
{
   printf("x=%f\n",x);
   return;
}

void testx2(float *x)
{
   printf("x=%f\n",*x);
   return;
}

float globx;

void testx3()
{
   printf("x=%f\n",globx);
   return;
}

void tests1(char *s)
{
   printf("s=%s\n",s);
   return;
}

void tests2(struct dsc$descriptor *s)
{
   int l;
   char *tmp;
   l = s->dsc$w_length;
   tmp = malloc(l+1);
   memcpy(tmp,s->dsc$a_pointer,l);
   tmp[l] = '\0';
   printf("s=%s\n",tmp);
   free(tmp);
   return;
}

$
$ fortran/object=z sys$input
      PROGRAM Z
      INTEGER I
      COMMON /GLOBI/I
      REAL X
      COMMON /GLOBX/X
      CALL TESTI1(%VAL(123))
      CALL TESTI2(%REF(123))
      I=123
      CALL TESTI3
      CALL TESTX1(%VAL(123.456))
      CALL TESTX2(%REF(123.456))
      X=123.456
      CALL TESTX3
      CALL TESTS1(%REF('HELLO'//CHAR(0)))
      CALL TESTS2(%DESCR('HELLO'))
      END
$
$ if f$getsyi("HW_MODEL") .lt. 1024
$ then
$ link z+zz+sys$input/opt
sys$share:vaxcrtl/share
$
$ else
$ link z+zz
$ endif
$ run z
$ exit
