HP3000-L Archives

December 1995, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Stan Sieler <[log in to unmask]>
Reply To:
Stan Sieler <[log in to unmask]>
Date:
Sat, 16 Dec 1995 23:24:17 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (87 lines)
Hi,
 
> 3) Is there a method by which I can list, programmatically, all the procedures
>    in a given RL, XL, or program executable?
>
>    hpux provides a function nlist() (man 3C).
 
As I read the man pages on nlist, it *seems* to say: nlist will tell you
detailed information about any symbol names *you already know*:
 
      The array of nlist() structures initially contains only the names of
      variables.  Once nlist() has been called, the variable names are
      augmented with types and values.  The list is terminated by a null
      name, which consists of a null string in the variable-name position of
      the structure.  The name list of the file is searched for each
      variable name.  If the name is found, type and value information from
      the file is inserted into the name list structure.  If the name is not
      found, type and value fields are set to zero.
 
So, the first line seems to imply that you had to pre-fill the data structure
with the list of "variables" (symbols) that you want info about ... which
doesn't match the desired functionality of your question #3 above.
 
However, you can sort of do what you want by programmatically running
the LINKEDITOR, give it an appropriate INFO string, and redirect the output
to a file:
 
    run linkedit.pub.sys;info = "listprog myprog.pub.myacct" > foo
or, for an XM use "listxl".
or, for an RL, use "listrl".
 
If you *really* want a procedure to call to do this, it might be possible
to adapt the code in the Avatar Tool (from Lund Performance Solutions) to
into such a form...at some cost.
 
> 4) Is there any method by which I can create a new executable based on
>    an existing executable, and add in some new objects or procedures?
>
>    e.g., I have program "foo" that I compiled and linked at an earlier date;
>    I have a set of new procedures in libx.a, or x.o that I need to
>    merge with the program "foo" to create a new better "foo". Is there
>    an easy way of doing this ?
>
>    Similar to "ld -A" on hpux and some other platforms.
 
Hmm... I haven't used "ld -A" on HP-UX, but "man ld" seems to imply that it
is designed to build a file which can be loaded into an already running
program later on ... although this is the opposite of what you are asking for,
the existence of "ld -A" obviously implies that there is some HP-UX
run-time method of *using* the file that "ld -A" built ... and it is that use
that matches your request...at least for run time (it doesn't seem to say
whether or not you can add anything to existing executables on disk).
 
Anyway....no.  Possibly because code is shared
across all people executing the same program?  That would imply that if person
A dynamically added more code to program K, if person B is currently
executing K too, they would have some degree of access to that new code...
which would imply run-time locating and modifying of every XRT currently
in use with processes running program K.
 
One possibility to is to investigate loading more and more libraries (XLs),
depending upon what the exact requirements are.  If your "new" code wants
to reference existing code in the program, this may be exceedingly difficult,
unless you build a mechanism to pass the original code addresses into the
new code.
 
> 5) Is there a guide out there to dynamic loading under a HP3000/MPE/iX
>    environment?  Are there any sample programs out there illustrating the
>    use of dynamic loading?
 
Not sure.
 
Generally, most (all?) uses of dynamic loading that I have seen involve
loading a library whose only unresolved externals are those that can
be successfully resolved from NL.PUB.SYS ... I can't recall if XL.PUB.SYS
is searched in the process of resolving externals for dynamically loaded
libraries.  I'm fairly sure that no user-specified libraries are searched :(
 
However, I seem to recall some recent conversations with HP that might point
the way towards a revised method of doing dynamic loading ...perhaps
someone from the lab will comment if this is so.
 
 
--
Stan Sieler                                          [log in to unmask]
                                     http://www.allegro.com/sieler.html

ATOM RSS1 RSS2