From owner-freebsd-hackers Thu Nov 16 17:25:57 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id RAA28505 for hackers-outgoing; Thu, 16 Nov 1995 17:25:57 -0800 Received: from rocky.sri.MT.net (rocky.sri.MT.net [204.182.243.10]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id RAA28481 ; Thu, 16 Nov 1995 17:25:47 -0800 Received: (from nate@localhost) by rocky.sri.MT.net (8.6.12/8.6.12) id SAA10855; Thu, 16 Nov 1995 18:27:45 -0700 Date: Thu, 16 Nov 1995 18:27:45 -0700 From: Nate Williams Message-Id: <199511170127.SAA10855@rocky.sri.MT.net> To: "Marc G. Fournier" Cc: freebsd-questions@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: Shared Libraries...almost there... In-Reply-To: References: Sender: owner-hackers@freebsd.org Precedence: bulk Marc G. Fournier writes: > > Hi... > > Well, I've finally got it down to the point that I have > to compile with -fpic, and then link with "ld -Bshareable" to create > a shared library...but it doesn't look right... > > Looking at /usr/share/mk/bsd.lib.mk, I'm supposed to be using > "shlib_version" to get major/minor numbers for the libraries I create, > but I can't find that. And, the shared library I created is over 3x > the size of the original ncurses shared library that comes with the > system...so I screwed up somewhere :( Look /usr/share/mk/bsd.lib.mk and note the ld commands. These are used to 'strip' out un-necessary (And some necessary according to Bruce) symbols out of the resulting .o files. .cc.so .C.so: ${CXX} ${PICFLAG} -DPIC ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} @${LD} -x -r ${.TARGET} @mv a.out ${.TARGET} So, if you use a .c.o target that is similar and add the 'ld -x -r' to the resulting .o I suspect your library will also be smaller. Nate