From owner-freebsd-questions Thu Feb 29 22:09:11 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id WAA18374 for questions-outgoing; Thu, 29 Feb 1996 22:09:11 -0800 (PST) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id WAA18297 for ; Thu, 29 Feb 1996 22:07:49 -0800 (PST) Received: from msmith@localhost by genesis.atrad.adelaide.edu.au (8.6.12/8.6.9) id QAA29879; Fri, 1 Mar 1996 16:38:43 +1030 From: Michael Smith Message-Id: <199603010608.QAA29879@genesis.atrad.adelaide.edu.au> Subject: Re: Compiling with shared libraries To: humprey@linux1.dlsu.edu.ph (Humprey C. Sy) Date: Fri, 1 Mar 1996 16:38:42 +1030 (CST) Cc: questions@freebsd.org In-Reply-To: from "Humprey C. Sy" at Mar 1, 96 01:44:26 am MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@freebsd.org Precedence: bulk Humprey C. Sy stands accused of saying: > > I'm confused about how shared libraries actually work. Here's my > problem: > > I was able to make a shared library file - libmac.a. What I'm confused If that's really a shared library, it should be libmac.so.1.0. How are you building it? If you were using the standard /usr/share/mk templates it'd be named correctly. > about is how come if I have to compile it together with my c program, I > have to place the option "-lmac" at the end of the command. i.e. > > cc -O2 zo.c -lmac > > If I try to include "-lmac" before zo.c, the procedures compiled in > libmac.a won't be seen at all, and the compiler returns errors saying > these procedures are unreferenced from text segment. Why is this so? The linker commandline is read left to right > - Humprey - -- ]] Mike Smith, Software Engineer msmith@atrad.adelaide.edu.au [[ ]] Genesis Software genesis@atrad.adelaide.edu.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control (ph/fax) +61-8-267-3039 [[ ]] Collector of old Unix hardware. "Where are your PEZ?" The Tick [[