Path: utzoo!attcan!uunet!snorkelwacker!bloom-beacon!eru!hagbard!sunic!sics.se!nmpbas.nmpcad.se!attila From: attila@nmpbas.nmpcad.se (Attila Nemeth) Newsgroups: comp.sys.apollo Subject: Dynamic linking on Apollo, how? Message-ID: <1990Oct4.150210.17095@sics.se> Date: 4 Oct 90 15:02:10 GMT Sender: news@sics.se Reply-To: attila@nmpbas.nmpcad.se (Attila Nemeth) Organization: Swedish Institute of Microelectronics, Kista Lines: 52 I have an application (interpreter) written under UNIX that are using dynamic linking. I want to port this application to BSD4.3 on Apollo. The application is an extension language interpreter. One of the features is the possibility to write a module, in let say C, and then load the module dynamically without relinking the interpreter. The interpreter achieves this by using ld -A option (on SUN and HP), which unfortunately has a different semantics under Apollo. The following steps are done in the interpreter to fix dynamic linking: 1. Call sbrk(0) to find out where the new module is going to be mapped. Set a pointer to this address. 2. Relink the core interpreter with the new module (ld -A ....) This gives a new -o file in the filesystem. 3. Open this file (COFF format), and read the header to find out the size of text, data, and bss. i.e. size = text + data + bss . 4. Call sbrk(size), then copy text and data of the new file to the old image (the pointer where to copy is given by step 1) 5. Use the relinked file in the filesystem, and access the symbol table (the interpreter needs some initialization routines) So my question is: Is it possible to obtain a relinked file in the filesystem and use its symbol table, i.e. I want to do the steps done in 3 and 5. How do you achieve dynamic linking under Apollo, what system calls are involved? Where is the new symbol table located, in the KGT? I would really appreciate if someone could give some help on this. --------------------------------------------------------------------- Attila Nemeth | Box 1193 | Electronic Mail: attila@inmic.se | IM/NMPCAD | 164 22 KISTA | Voice: +46 8 752 11 75 | | SWEDEN | Fax: +46 8 750 80 56 | ---------------------------------------------------------------------