Sujet : Re: Fun trick
De : johnrreagan (at) *nospam* earthlink.net (John Reagan)
Groupes : comp.os.vmsDate : 08. Jan 2025, 18:37:44
Autres entêtes
Organisation : i2pn2 (i2pn.org)
Message-ID : <3e4166d654be19fea5da4abf1eca5fd593cc0ac2@i2pn2.org>
References : 1
User-Agent : Mozilla Thunderbird
On 1/7/2025 8:58 PM, Arne Vajhøj wrote:
During some troubleshooting over at VSI forum hb told me that
running a shareable image will execute LIB$INITIALIZE
functions.
That made me write this:
$ type lib.pas
[inherit('sys$library:pascal$lib_routines', 'sys$library:starlet')]
module lib(input, output);
[global]
procedure check;
var
imgnam : varying [1024] of char;
begin
lib$getjpi(item_code := jpi$_imagname, resultant_string := imgnam.body, resultant_length := imgnam.length);
if index(imgnam, ']libshr.EXE') > 0 then begin
writeln('This is a shareable image to link against not run');
$exit(ss$_normal);
end;
end;
[global]
procedure say;
begin
writeln('Hi');
end;
end.
$ type prg.pas
program prg(input,output);
[external]
procedure say; external;
begin
say;
end.
$ type trick.mar
.title trick
.extrn lib$initialize
.psect lib$initialize long,nopic,con,gbl,noshr,noexe,nowrt
.address check
.end
$ macro trick
$ pas lib
$ link/share=libshr lib + trick + sys$input/opt
SYMBOL_VECTOR=(say=PROCEDURE)
$
$ define/nolog libshr sys$disk:[]libshr
$ pas prg
$ link prg + sys$input/opt
libshr/share
$
$ run prg
Hi
$ run libshr
This is a shareable image to link against not run
:-)
Arne
Pascal has an [INITIALIZE] attribute that you can put on the PROCEDURE CHECK and the compiler should do the contribution to the LIB$INITIALIZE PSECT.
And you should include LIB$INITIALIZE (the code module, not the data PSECT) from STARLET when linking. The x86 linker will do that for you, but the Alpha and Itanium linkers do not.
Date | Sujet | # | | Auteur |
8 Jan 25 | Fun trick | 39 | | Arne Vajhøj |
8 Jan 25 |  Re: Fun trick | 1 | | Lawrence D'Oliveiro |
8 Jan 25 |  Re: Fun trick | 11 | | John Reagan |
8 Jan 25 |   Re: Fun trick | 10 | | Arne Vajhøj |
8 Jan 25 |    Re: Fun trick | 9 | | John Reagan |
8 Jan 25 |     Re: Fun trick | 2 | | Arne Vajhøj |
8 Jan 25 |      Re: Fun trick | 1 | | Arne Vajhøj |
8 Jan 25 |     Re: Fun trick | 6 | | Arne Vajhøj |
14 Jan 25 |      Re: Fun trick | 5 | | John Reagan |
14 Jan 25 |       Re: Fun trick | 4 | | Lawrence D'Oliveiro |
14 Jan 25 |        Re: Fun trick | 3 | | Arne Vajhøj |
14 Jan 25 |         Re: Fun trick | 1 | | Arne Vajhøj |
15 Jan 25 |         Re: Fun trick | 1 | | John Reagan |
8 Jan 25 |  Re: Fun trick | 26 | | hb0815 |
8 Jan 25 |   Re: Fun trick | 25 | | Arne Vajhøj |
8 Jan 25 |    Re: Fun trick | 24 | | hb0815 |
9 Jan 25 |     Re: Fun trick | 23 | | Arne Vajhøj |
9 Jan 25 |      Re: Fun trick | 22 | | hb0815 |
13 Jan 25 |       Re: Fun trick | 11 | | Arne Vajhøj |
17 Jan 25 |        GNU diff command, was: Re: Fun trick | 10 | | Simon Clubley |
17 Jan 25 |         Re: GNU diff command, was: Re: Fun trick | 9 | | Craig A. Berry |
17 Jan 25 |          Re: GNU diff command, was: Re: Fun trick | 8 | | Craig A. Berry |
19 Jan 25 |           Re: GNU diff command, was: Re: Fun trick | 7 | | hb0815 |
21 Jan 25 |            Re: GNU diff command, was: Re: Fun trick | 6 | | Craig A. Berry |
22 Jan 25 |             Re: GNU diff command, was: Re: Fun trick | 5 | | hb0815 |
22 Jan 25 |              Re: GNU diff command, was: Re: Fun trick | 4 | | Lawrence D'Oliveiro |
23 Jan 25 |               Re: GNU diff command, was: Re: Fun trick | 3 | | Robert A. Brooks |
24 Jan 25 |                Re: GNU diff command, was: Re: Fun trick | 2 | | Simon Clubley |
25 Jan 25 |                 Re: GNU diff command, was: Re: Fun trick | 1 | | Dave Froble |
13 Jan 25 |       Re: Fun trick | 10 | | Arne Vajhøj |
13 Jan 25 |        Re: Fun trick | 9 | | Lawrence D'Oliveiro |
13 Jan 25 |         Re: Fun trick | 8 | | Arne Vajhøj |
14 Jan 25 |          Re: Fun trick | 6 | | John Reagan |
14 Jan 25 |           Re: Fun trick | 5 | | Arne Vajhøj |
3 Feb 25 |            Cobol (was Re: Fun trick) | 1 | | Arne Vajhøj |
3 Feb 25 |            Re: Fun trick | 3 | | Arne Vajhøj |
3 Feb 25 |             Cobol (was: Re: Fun trick) | 2 | | Arne Vajhøj |
5 Feb 25 |              Re: Cobol | 1 | | Arne Vajhøj |
14 Jan 25 |          Re: Fun trick | 1 | | Lawrence D'Oliveiro |