home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.os.vms      DEC's VAX* line of computers & VMS.      264,096 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 262,218 of 264,096   
   =?UTF-8?Q?Arne_Vajh=C3=B8j?= to John Reagan   
   Re: Fun trick   
   08 Jan 25 14:36:13   
   
   From: arne@vajhoej.dk   
      
   On 1/8/2025 12:37 PM, John Reagan wrote:   
   > 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:   
   ...   
   > 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.   
      
   Zweite Sehr Verbesserte Ausgabe:   
      
   $ type lib.pas   
   [inherit('sys$library:pascal$lib_routines', 'sys$library:starlet')]   
   module lib(input, output);   
      
   [initialize]   
   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.   
   $ pas lib   
   $ link/share=libshr lib + sys$library:starlet/lib/incl=lib$initialize +   
   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   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca