[Info-vax] VMS Software Q1 '23 Update

Arne Vajhøj arne at vajhoej.dk
Thu Jan 26 17:27:36 EST 2023


On 1/26/2023 9:32 AM, Arne Vajhøj wrote:
> I do not think the exact same problem can be recreated in
> Basic (as far as I can read the documentation then Basic
> does not allow static initialization in map's).
> 
> But to show something in Basic it is easy to do with
> assignment:
> 
> program p
> 
> map (d) long lw1, long lw2
> 
> external sub s1, s2
> 
> lw1 = 1
> lw2 = 2
> 
> call s1
> call s2
> 
> print lw1, lw2
> 
> end program
> !
> sub s1
> 
> map (d) word w1, word w2, word w3, word w4
> 
> w2 = 1
> w4 = 2
> 
> end sub
> !
> sub s2
> 
> map (d) byte b1, byte b2, byte b3, byte b4, byte b5, byte b6, byte b7, 
> byte b8
> 
> b4 = 1
> b8 = 2
> 
> end sub
> 
> $ bas p
> $ lin p
> $ r p
>   16842753      33685506

The Fortran version with static initialization (using data statements!)
and no calls:

$ type p2x.for
       program p2
       integer*4 lw1,lw2
       common /d/lw1,lw2
       data lw1/1/,lw2/2/
       write(*,*) lw1,lw2
       end
$ for p2x
$ type s1.for
       subroutine s1
       integer*2 w1,w2,w3,w4
       common /d/w1,w2,w3,w4
       data w2/1/,w4/2/
       end
$ for s1
$ type s2.for
       subroutine s2
       integer*1 b1,b2,b3,b4,b5,b6,b7,b8
       common /d/b1,b2,b3,b4,b5,b6,b7,b8
       data b4/1/,b8/2/
       end
$ for s2
$ link p2x + s1 + s2
$ run p2x
    16842753    33685506
$ link p2x + s2 + s1
$ run p2x
       65537      131074

(tested on VMS Alpha)

The order of the OBJ files in the link command change the output.

Yuck.

Arne







More information about the Info-vax mailing list