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

Craig A. Berry craigberry at nospam.mac.com
Thu Mar 18 13:07:47 EDT 2021


On 3/18/21 2:12 AM, Joukj wrote:
> Arne Vajhøj wrote:
>> 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
>>
> 
> I got it solved: I realy had to reboot (I thought OpenVMS was not 
> Windows(#$%^&@)). So simply remove old GKS, install new GKS and rerun 
> @sys$startup:gkstartup is not enough; in that case you will end-up in a 
> "mixed version of old/new.

I wondered if you had a mix of old and new logical names, in which case
it might have been able to clear things out without rebooting.  But glad
you got is solved in any case.

> Indeed, Fortran passes all parameters by-reference, except character 
> strings which are passed by-descriptor. (unless you specify %ref() or 
> %val()).
> 
> In case of gopwk it seems that passing 0, %val(0) and FB_DEF_LUN 
> (defined in sys$library:gks.f) all work to get the default.
> 
> 




More information about the Info-vax mailing list