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:
Bill Bennett CSY <[log in to unmask]>
Reply To:
Bill Bennett CSY <[log in to unmask]>
Date:
Thu, 14 Dec 1995 01:53:07 GMT
Content-Type:
text/plain
Parts/Attachments:
text/plain (144 lines)
On 12 Dec 1995 16:41:29 GMT, David Groves ([log in to unmask]) wrote:
: Greetings, fellow combatants:
 
: Today I have a few questions on the above topics, and I trust that the
: knowledge pool available here will contain some salient insights into the
: mysteries therein, to-wit:
 
: 1) Does c89 support the creating of shared libraries (the *.so files on
HP-UX)
:    and if it does not, are there plans to add support for shared libraries in
:    the near future?
 
LINKEDIT is the only way to create XLs. LINKEDIT supports all the HP 3000
languages and I don't think there are plans to support the specific c89
implementation.
 
: 2) A small test program was developed that calls the HP Intrinsic
HPGETPROCPLABEL
:    with POSIX files names that dynamically loads a procedure contained in a
:    hared library (at least what passes for one with our present
understanding,
:    named with the .sl suffix here).
 
:    The shared library was built using the "callci linkedit" command as
follows:
 
:      callci "linkedit;info='buildxl;xl=./libfoo.sl;limit=2000';parm=7"
:      callci
"linkedit;info='addxl;from=./func_foo.o;to=./libfoo.sl;share';parm=7
 
:    The executable thus built dynamically loads the procedure 'y' from the
shared
:    library in the following manner:
 
:      HPGETPROCPLABEL("%y%",&plabel, &mpe_stat, "%./libfoo.sl%",0);
 
:    This all works very well and the dynamically-loaded function can be
invoked
:    correctly.
 
:    However, if the dynamically-loaded procedure calls another procedure, 'x',
that
:    already lives in the executable program, then we get an error:
 
:      UNRESOLVED EXTERNALS: x (LDERR 522)
:      Native mode loader message 522
 
:    How do I get the program to see the procedure that is already there?
:    How does the binding sequence work?  I have included XL's with the
:    UNRESOLVED externals when running the program (using the
:    xl=librarya,libraryb), but this does not seem to work.
 
MPE/iX supports a single pass binding sequence. First the program including
RLs is resolved and the XLs in the XL= order are used. For example:
    RUN FOO;XL=XL1,XL2
any unresolved externals in FOO can be resolved in XL1 or XL2 or XL.PUB.SYS
(you
always get this). Unresolved externals in XL1 can only be resolved in XL2 or
XL.PUB.SYS and not in FOO. And finally XL2 can only resolve to XL.PUB.SYS.
 
If you are using HPGETPROCPLABEL the loaded procedure must be resolved within
the one XL (and XL.PUB.SYS). So in your example you should put all the
procedures in the librarya XL.
 
Is there a reason you are using dynamically-loaded procedures? The MPE/iX
loader usually does a good job of loading. You might want to look at the
C.50.00 Communicator article "POSIX libraries in XLs" for examples on how
to work with XLs.
 
: 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).
 
LISTPROG, LISTRL and LISTXL in LINKEDIT are the only easy way I know of
to get the information.
 
: 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.
 
There is no way to pull apart a program and reassemble it on MPE/iX. Programs
can only be made with .o and .a files.  How program components are usally
changed on the HP 3000 is to put them in XLs first and then just exchange the
XL file.  Also if you make the XL right you can change out entries in the XL.
Take a look at the LINKEDIT manual.
 
: 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?
 
Again, is there a need for dynamic loading?  Take a look at the Communicator.
 
 
In the Communicator 3000 Release C.50.00 there is an article titled "POSIX
Libraries in XLs" (pg. 10-33). It deals with Shared Globals and how to use
this new feature to put POSIX C executables in executable library files (XLs).
There is an error with the examples shown for each method. When linking in
the LIBC RL into an XL the _start entry must be removed if you use the MERGE
option. If _start is not removed, any program that uses this XL will get the
following error when it's run:
 
  UNRESOLVED EXTERNALS: main (LDRERR 512)
  Failed to locate the exported code symbol(s) for the imported code symbol(s)
  listed above. (LSRERR 522)
  Native mode loader message 522
  Unable to load program to be run. (CIERR 625)
 
For the example of Method 1 (pg. 10-34) insert the following between the
LINK and BUILDXL commands:
 
  PURGERL ENTRY=_start;RL=LIBC
 
Note: _start is still necessary in the program, that is why the PURGERL is
  done after the LINK. (you may want to make two versions of LIBC, one with
  _start and on without)
 
For the examples of Method 2 and 3 (pg. 10-35/36) insert the following
between the EXTRACTRL and LINK commands:
 
  PURGERL ENTRY=_start;RL=LIBC
 
In my orginal article the examples didn't have the MERGE option. During
review the MERGE was added and the examples were not re-tested. Sorry for
any inconvenience this may have caused.
 
Hope this helps.
 
--
---------------------------------------------------------------------------
Bill Bennett                                            [log in to unmask]
Hewlett Packard Company
Commercial Systems Division                            phone (408) 447-7858
19447 Pruneridge Avenue, MS 47UA                       fax   (408) 447-4278
Cupertino, California 95014
---------------------------------------------------------------------------

ATOM RSS1 RSS2