Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Mar 1996 15:03:24 +0800 (GMT+0800)
From:      "Humprey C. Sy" <humprey@linux1.dlsu.edu.ph>
To:        Michael Smith <msmith@atrad.adelaide.edu.au>
Cc:        questions@freebsd.org
Subject:   Re: Compiling with shared libraries
Message-ID:  <Pine.LNX.3.91.960301143546.1369B-100000@ccslinux.dlsu.edu.ph>
In-Reply-To: <199603010608.QAA29879@genesis.atrad.adelaide.edu.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 1 Mar 1996, Michael Smith wrote:

> > 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.

I used the bsd.lib.mk template.  It produced libmac.a, that's all.  
What's the difference between <lib>.a and <lib>.so.X.X files anyway?  I 
thought they're both the same, save for compatibility reasons only.

> > 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

I still don't get the difference.  Either way both files will be linked 
together, so why can't the linker find those procedures in libmac.a if I 
typed -lmac before zo.c?

- Humprey -





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.3.91.960301143546.1369B-100000>