Print

Print


On Nov 9, 2005, at 5:20 PM, Neil Carlson wrote:

> Some software apps are made user-extensible by providing a mechanism 
> for dynamically loading a user-written shared object file into the 
> executable code.  I'm know the details are platform-specific, and 
> almost certainly involve some special C code, but can anyone point me 
> to some how-tos, examples, etc., especially when it is done in the


This is reminiscent of something I used back in the days of VM/370 on
IBM mainframes. In building the original executable, you could tell the
link editor to keep the symbol table with the executable, and at run
time the table would be loaded into high memory, with code in low
memory, replicating how the link editor built the thing in the first
place. A SVC assembler call could invoke the LOAD command of CMS to load
in an object file created by the compiler, as though the linking process
were still underway. The new object would be loaded above existing code
and relocated, and external references specified within the new object
file would be resolved using the existing symbol table. The address of
where the LOAD processing put the loaded object file was returned to the
caller, which would save the address. The main group of subprograms, by
design, provided for a number of stubs for "user-written routines," with
standardized names like "USER01." These were used by passing the name to
the assembler routine that managed the loading:
      CALL LINKER('USER01', arg1, arg2, ....)
LINKER would cause the LOAD to occur the first time and save the address
of what got loaded. On subsequent calls, the already loaded routine
would simply be called directly and given the rest of the argument list.
Running things this way allowed the routine loaded on the fly to
reference various utility/service routines previously linked with the
executable, through the in-memory symbol table. Thus the main package
could be designed to handle nearly all of what most users needed done,
while providing the ability for power users to write their own routines
for special calculations. By providing documented interfaces to standard
facilities within the main package, not only could the main package call
user-written routines to do extra things, those routines could call back
to routines already in the main package to do part of the calculations.

Since this sort of thing is technically feasible, it really would be
nice if the vendors of linkers for Windows and other operating systems
provided the equivalent facility for developers. Have they?

Dick Russell

-----------------------------------------
*****************Internet Email Confidentiality
Footer******************

Privileged/Confidential Information may be contained in this message.  
If you are not the addressee indicated in this message (or responsible 
for delivery of the message to such person), you may not copy or
deliver
this message to anyone. In such case, you should destroy this message
and notify the sender by reply email. Please advise immediately if you
or your employer do not consent to Internet email for messages of this
kind. Opinions, conclusions and other information in this message that
do not relate to the official business of The Shaw Group Inc. or its
subsidiaries shall be understood as neither given nor endorsed by it.
_______________________________________________________________________
_
The Shaw Group Inc.
http://www.shawgrp.com