[comp.os.vms] transfer vectors

briggs%gburg.DECnet@BLUTO.SCC.COM ("GBURG::BRIGGS") (07/22/87)

In article <2961@blia.BLI.COM> forrest@blia.BLI.COM (Jon Forrest) writes:
>For example, let's say that a sharable image contains variable A which
>is 10 bytes long and begins at location 100 and variable B which is
>20 bytes long and begins at location 110. We can assume both are
>universal symbols. The user links an application program that references
>both variables with this sharable image. Everything works fine.
>Meanwhile, the software developer who sold the user the shareable
>image modifies variable A so that it now is 20 bytes long. This
>means that variable A begins at 100, as before, but now variable
>B now begins at location 120. Then, the user receives this new
>shareable image and, much to his consternation, finds that his
>program bombs every time he references location B.

Randy Buckland answers:
>The solution is really simple. Have a section of code that will
>always be at a fixed address and will contain pointers to the data structures.
>The pointers will always be 4 bytes and the addresses won't change. You
>can change the size of the structure and you could even change it
>at run time and the program won't care since it always accesses it through
>the pointer that is in a known location.

Good point, Randy, but not applicable in this case.  If somebody is changing
variable lengths on you, all the indirection in the world won't solve the
problem.  You not only have to relink, you have to modify source code and
recompile!

Juergen Renz flames:

>Your [sic] wrong Randy !
>One transfer vector takes up to 8 bytes (entry routine):
>...
Again, good point, but not applicable here.  The problem is access to variables,
not access to entry points.  If Mr. Forest had been trying to CALL or JSB into
the shareable image, a 6 or 8 byte transfer vector would be required.  Since
he only needs to access variables in the image, 4 byte longword pointers are
quite adequate.

	John Briggs		Arpa:	BRIGGS@BLUTO.SCC.COM
				MA:	(301)840-4932
				Snail:	Vitro Corporation
					14000 Georgia Ave.
					Silver Spring, MD  20906
+----83

rcb@rti.UUCP (Random) (07/23/87)

>Randy Buckland answers:
>>The solution is really simple. Have a section of code that will
>>always be at a fixed address and will contain pointers to the data structures.
>>The pointers will always be 4 bytes and the addresses won't change. You
>>can change the size of the structure and you could even change it
>>at run time and the program won't care since it always accesses it through
>>the pointer that is in a known location.
>
>Good point, Randy, but not applicable in this case.  If somebody is changing
>variable lengths on you, all the indirection in the world won't solve the
>problem.  You not only have to relink, you have to modify source code and
>recompile!
>

One more time......

The pointer variables (using 4 bytes each) are interleaved with the 
transfer vectors right at the front of the shared image. Once allocated a space
in the transfer vector psect, their address relative to the front of the
shared image NEVER moves. The value stored in those four bytes can change
as things move around in the body of the shared image, but the pointer
is always at a fixed address at the head of the image just like a transfer
vector.
-- 
					Randy Buckland
					Research Triangle Institute
					rcb@rti.rti.org [128.109.139.2]
					{decvax,ihnp4,seismo}!mcnc!rti-sel!rcb