Date: Fri, 1 Mar 1996 09:09:46 -0700 From: Sean Kelly <kelly@fsl.noaa.gov> To: humprey@linux1.dlsu.edu.ph Cc: questions@freebsd.org Subject: Re: Compiling with shared libraries Message-ID: <9603011609.AA17859@emu.fsl.noaa.gov> In-Reply-To: <Pine.LNX.3.91.960301143546.1369B-100000@ccslinux.dlsu.edu.ph> (humprey@linux1.dlsu.edu.ph)
next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> "Humprey" == "Humprey C Sy" <humprey@linux1.dlsu.edu.ph> writes: Humprey> I used the bsd.lib.mk template. It produced libmac.a, Humprey> that's all. What's the difference between <lib>.a and Humprey> <lib>.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/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9603011609.AA17859>