From owner-freebsd-questions Fri Mar 1 08:10:39 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id IAA22293 for questions-outgoing; Fri, 1 Mar 1996 08:10:39 -0800 (PST) Received: from fslg8.fsl.noaa.gov (fslg8.fsl.noaa.gov [137.75.131.171]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id IAA22288 for ; Fri, 1 Mar 1996 08:10:32 -0800 (PST) Received: by fslg8.fsl.noaa.gov (5.57/Ultrix3.0-C) id AA23986; Fri, 1 Mar 96 10:09:57 -0600 Received: by emu.fsl.noaa.gov (1.38.193.4/SMI-4.1 (1.38.193.4)) id AA17859; Fri, 1 Mar 1996 09:09:46 -0700 Date: Fri, 1 Mar 1996 09:09:46 -0700 Message-Id: <9603011609.AA17859@emu.fsl.noaa.gov> From: Sean Kelly To: humprey@linux1.dlsu.edu.ph Cc: questions@freebsd.org In-Reply-To: (humprey@linux1.dlsu.edu.ph) Subject: Re: Compiling with shared libraries Sender: owner-questions@freebsd.org Precedence: bulk >>>>> "Humprey" == "Humprey C Sy" writes: Humprey> I used the bsd.lib.mk template. It produced libmac.a, Humprey> that's all. What's the difference between .a and Humprey> .so.X.X files anyway? I thought they're both the Humprey> same, save for compatibility reasons only. Nope. In the .so.X.X, you put position-independent objects. I've found the easiest way to make the archive, the profiled archive, and the shared library is to use the bsd.lib.mk template and make a file called shlib_version. In it, put these lines: major=1 minor=0 (or whatever version numbers you want). Humprey> I still don't get the difference. Either way both files Humprey> will be linked together, so why can't the linker find Humprey> those procedures in libmac.a if I typed -lmac before Humprey> zo.c? Here's an oversimplification: the linker will keep definitions for symbols that are actually used and toss out the others. With your mac library first, you get a bunch of symbol definitions and no references for them, so they're tossed out. Then here comes your zo.o, which has references for them, but they're nowhere to be found. The other way around, the linker knows it need definitions for those undefined references in zo.o, and it'll add those when it next sees the mac lib. -- Sean Kelly NOAA Forecast Systems Laboratory kelly@fsl.noaa.gov Boulder Colorado USA http://www-sdd.fsl.noaa.gov/~kelly/