[Info-vax] GKS : gopwk problem with VSI's version of GKS

Arne Vajhøj arne at vajhoej.dk
Wed Mar 17 14:31:48 EDT 2021


On 3/17/2021 1:06 PM, Craig A. Berry wrote:
> My Fortran is awfully rusty, but if the intent is to pass a NULL
> pointer, wouldn't the second argument need to be %VAL(0) rather than 0?

Yes. Fortran default to BYREF for integers - not BYVAL.

$ type c.c
#include <stdio.h>
#include <string.h>

void m(const char *s)
{
     if(s == NULL)
     {
         printf("s = NULL\n");
     }
     else
     {
         printf("s len = %d\n", strlen(s));
     }
}

$ cc c
$ type f.for
       program f
       external m
       call m(%val(0))
       call m(0)
       call m(%ref('ABC'))
       end
$ for f
$ link f + c
$ run f
s = NULL
s len = 0
s len = 3
$

Arne




More information about the Info-vax mailing list