🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #851

Re: Dynamic Loading

#851
From: Gil Tene
Date: Fri, 07 Sep 1990 22:21
35 lines
2170 bytes
In article <HALLETT.90Sep6142725@enterprise.positron.gemed.ge.com> hallettJ@geme
d.ge.com writes:
>
>I'm interested in doing something funky.  I have a shell running that
>basically interprets user commands and then calls a procedure to
>handle the command.  Each command is self-contained.  Now, I want to
>allow a user to add commands.  The mechanism I would like to try is to
>have the user create a .o file with the compiled code in it, then,
>when he enters his command into the shell, have the shell load the .o
>file and execute the code in it.  The only problem is that I don't
>have a clue where to look to figure out how to do this.
>

Look up the "-A" option in the ld(1) man page. This option lets
you take a .o file, and link it to an existing a.out format file
(executable). The result is a code file that you can load into
memory, and jump into. I have some example code (not well commented)
that does this, if you are interested.

Beware : some unix systems DO NOT have this feature. I am sure it
works in BSD and SunOS, but I have checked DG/UX on an Aviion
(as an example), and it has no -A option to ld.

BTW : This ld -A option is called "incremental" loading. "Dynamic"
loading is a term used concerning run-time and shared library loads.
(At least that's the BSD and SunOS terminology).

Hope this helps,

Gil.
--
--------------------------------------------------------------------
| Gil Tene                      "Some days it just doesn't pay     |
| devil@techunix.technion.ac.il   to go to sleep in the morning."  |
--------------------------------------------------------------------
Technical Details
Message-ID: <9769@discus.technion.ac.il>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!ucbvax!techunix.BITNET!devil
References: <HALLETT.90Sep6142725@enterprise.positron.gemed.ge.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!ucbvax!techunix.BITNET!devil
From: devil@techunix.BITNET (Gil Tene)
Newsgroups: comp.unix.programmer
Subject: Re: Dynamic Loading
Message-ID: <9769@discus.technion.ac.il>
Date: 7 Sep 90 22:21:36 GMT
References: <HALLETT.90Sep6142725@enterprise.positron.gemed.ge.com>
Sender: daemon@ucbvax.BERKELEY.EDU
Reply-To: devil%techunix.bitnet@lilac.berkeley.edu (Gil Tene)
Organization: Technion, Israel Inst. Tech., Haifa Israel
Lines: 35