Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rice!sun-spots-request From: synaptx!glenn@uunet.uu.net (Glenn Gribble) Newsgroups: comp.sys.sun Subject: Re: dynamic loading under SunOS 4.1 Keywords: Source Message-ID: <8451@brazos.Rice.edu> Date: 4 Jun 90 17:22:47 GMT Sender: root@rice.edu Organization: Sun-Spots Lines: 48 Approved: Sun-Spots@rice.edu X-Refs: Original: v9n188, Replies: v9n188 X-Sun-Spots-Digest: Volume 9, Issue 190, message 8 There is another way to do dynamic loading: DESCRIPTION This is a dynamic loader for Sun3 and Sun4. The interface is very simple. There are three main functions: setArg0(const char *) - Call with argv[0] to find main object file bool loadFile(const char *fileName) - Load an object file long value(const char *sym, int bad=-1) - Find symbol value This loader reads the object file into memory and does the relocation on its own. This makes it fast and it works even if the main object file is dynamically linked (the loaded object file can make calls into the shared libraries). The advantages of this loader over SunOS 4.1 dlopen() or "ld -A": 1) Works with normal object files (does not use shared libraries) 2) Works if the main object file is dynamically linked. 3) Loaded object can have symbol dependencies into main file or previously loaded object files. 4) It is much faster than the "ld -A" approach. The disadvantage: 1) It will not load every type of file since I have not found ways of making all relocation types in Sun object files. Other things to note: 1) It is written in C++. 2) It is free and unsupported (although I would like to hear of bugs). Glenn Gribble glenn@synaptics.com uunet!synaptx!glenn Synaptics, Inc. (408) 434-0110 2860 Zanker Road, Suite 105 (408) 434-9819 FAX San Jose, CA 95134 [[Ed's Note: Source placed in archives. -bdg]] FTP: Hostname : titan.rice.edu (128.42.1.30) Directory: sun-source Filename : dynload.shar Filesize : 23435 bytes Archive Server Address: archive-server@rice.edu Archive Server Command: send sun-source dynload.shar