dynamic loading under SunOS 4.1

Chuck Ocheret chuck at morgan.com
Wed May 30 01:08:11 AEST 1990


I,ve read the discussion of shared libaries and the man pages for
dlopen(), dlsym(), etc..., ld, a.out and more and have still not resolved
the proper way to accomplish dynamically loading object code into an
executing process.

Here is how I do it under 4.0.x:

1. Create the .o file that I want to dynamically load in.
2. From the running process run ld with the -A option for
   incremental loading.  This gives me the size of the incremental
   a.out file.
3. Allocate space for the a.out file.
4. Run ld -A again to relocate the a.out file to the allocated space.
5. Read the a.out file into the allocated space.
6. Invoke nlist(3) to get addresses of entries in the symbol table.

The problem with this under 4.0.x is that I have to link statically and I
have to link twice.  Does anyone have a recipe for how to do this under
4.1.  I am hoping to avoid the time-consuming double static link.

Please e-mail directly to me and I will summarize.  I will also post the
code that results for the information I receive.

Thanks,
+------------------+   Chuck Ocheret, Sr. Staff Engineer   +-----------------+
| chuck at Morgan.COM |       Morgan Stanley & Co., Inc.      | (212) 703-4474  |
|   Duty now ...   |19th Floor, 1251 Avenue of the Americas| for the future. |
+------------------+       New York, N.Y.  10020 USA       +-----------------+



More information about the Comp.sys.sun mailing list