Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Mar 1996 16:38:42 +1030 (CST)
From:      Michael Smith <msmith@atrad.adelaide.edu.au>
To:        humprey@linux1.dlsu.edu.ph (Humprey C. Sy)
Cc:        questions@freebsd.org
Subject:   Re: Compiling with shared libraries
Message-ID:  <199603010608.QAA29879@genesis.atrad.adelaide.edu.au>
In-Reply-To: <Pine.LNX.3.91.960301013748.19707A-100000@ccslinux.dlsu.edu.ph> from "Humprey C. Sy" at Mar 1, 96 01:44:26 am

next in thread | previous in thread | raw e-mail | index | archive | help
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  [[



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603010608.QAA29879>