[comp.os.vms] Shareable images ...

taso@munnari.oz (Taso Hatzi) (09/06/87)

I want to combine a set of routines into a shareable image.  The
routines contain static (ie. non-stack) variables.  Some of the
variables are private to a routine while others are global to all of
the routines in the shareable image.  I want each program which calls
routines in the shareable image to get its own copy of the variables.  The
variables should be initialized (to zero) each time a program which
uses the shareable image is activated.

What attributes must I give to the psect's containing the variables 
in order to achieve this.  Also, how should I install the shareable
image?  Or in other words, how can I arrange it so that the global
section which contains the psects which contain the variables has the
`copy on reference' attribute m

ted@blia.BLI.COM (Ted Marshall) (09/08/87)

In article <1812@munnari.oz>, taso@munnari.oz (Taso Hatzi) writes:
> I want to combine a set of routines into a shareable image...
>                                  ...  I want each program which calls
> routines in the shareable image to get its own copy of the variables...
> What attributes must I give to the psect's containing the variables 
> in order to achieve this.  Also, how should I install the shareable
> image?...

I believe that all you have to do is give the psects the NOSHR attribute,
along with WRT and whatever else you would use for writable data. This
instructs that the psect, although part of the shareable image, are private
to each process. You then can install the image as any other (i.e. /SHARE
/OPEN). Because the writable psects are private, you don't need /WRITEABLE.

-- 
Ted Marshall       ...!ucbvax!mtxinu!blia!ted <or> mtxinu!blia!ted@Berkeley.EDU
Britton Lee, Inc., 14600 Winchester Blvd, Los Gatos, Ca 95030     (408)378-7000
The opinions expressed above are those of the poster and not his employer.

WHIT@uwastm.phys.washington.EDU ("John Whitmore, III ") (05/18/88)

>From: Rudolph Shally <ras%hep.nrc.cdn%ean.ubc.ca@RELAY.CS.NET>
>To: Richard Seymour <SEYMOUR@phast>
>Reply-to: INFO-VAX@KL.SRI.COM
>Comments: To: info-vax@KL.SRI.COM
>
>The problem is how to override a routine in a shareable image.
>The image contains several routines, say 1000 and many of those
>call another routine (say QNEXTE) in the same image. QNEXTE
>in turn, calls another routine, say, QNEXT. In VAX macro the call is
>(in QNEXTE):
>
>       CALLS   #0,QNEXT
>
>The trouble is that QNEXT is supposed to be a user supplied routine
>while I had to include a dummy routine QNEXT in the shareable image
>since everything must be linked. When the user links his main program
>and his own QNEXT with the shareable image the linker won't accept
>the user supplied routine QNEXT since a dummy version is already
>in the shareable image. How can one owerride the dummy routine?

      The creating LINK for the shared executable had to include
a reference for the QNEXT routine, or fail to LINK successfully.
The reference can be any of a number of things: a *.OBJ object module
file, a shareable image, or an object or shareable image library
      Unfortunately, the shared executable will incorporate
an object module if it is given one, and this cannot be later
"un-LINKed" to allow the user his desired QNEXT routine.
Shared executables to the rescue!  One must create a shared
executable (if necessary, tutoring the users so they can do it
for themselves) containing a dummy QNEXT routine, and allow the
user the option of
      $LINK/EXE=user_qnext.exe user_qnext/SHAREABLE
      $DEFINE QNEXT_IMAGE disk:[userdir]user_qnext.exe
      $LINK program,QNEXTE_IMAGE_OPTION/OPTION
where the QNEXTE_IMAGE_OPTION file contains
      QNEXTE_IMAGE/SHARE,-
      QNEXT_IMAGE/SHARE
      .
      .
      .