From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10c665,b5dc64466a3dd2b5 X-Google-Attributes: gid10c665,public X-Google-Thread: 11035d,b5dc64466a3dd2b5 X-Google-Attributes: gid11035d,public X-Google-Thread: fee84,b5dc64466a3dd2b5 X-Google-Attributes: gidfee84,public X-Google-Thread: fb4a0,b5dc64466a3dd2b5 X-Google-Attributes: gidfb4a0,public From: Doug Hockin Subject: Re: How to make a dynamic linked library? Date: 1999/04/23 Message-ID: <3720B83D.BD17BAB2@wang.com>#1/1 X-Deja-AN: 470066484 Content-Transfer-Encoding: 7bit References: <3719391A.47B64999@hopper.math.uwaterloo.ca> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Velan Central Library - Terran Annex Mime-Version: 1.0 Newsgroups: comp.unix.osf.osf1,comp.unix.solaris,comp.unix.unixware,comp.unix.osf.osf1,comp.unix.sys5.r4 I don't have experience with the GNU compiler but can give suggestions for SVR4 and they are probably similar. Compile the program with the -Kpic option to produce position independent code. Then link it with -dy (to get it dynamically linked) and -G (to make it a shared library). When you compile/link the programs that will use the library you need to link them with a -l option. If you name your library libmine and put it into /usr/lib then you can use -lmine. If you put the library somewhere else you'll also need to use -Lpath to specify the path to your library. The -L option should precede the -l option on the command line. -- Doug