*BSD News Article 49287


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!lll-winken.llnl.gov!noc.near.net!news.mathworks.com!tank.news.pipex.net!pipex!in1.uu.net!nctuccca.edu.tw!news.cc.nctu.edu.tw!news.csie.nctu.edu.tw!nematic.ieo.nctu.edu.tw!jou
From: jou@nematic.ieo.nctu.edu.tw (Wei-Jou Chen)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: [Q] Dynamical linking library
Date: 22 Aug 1995 22:56:31 GMT
Organization: Liquid Crystal Lab, NCTU, Taiwan, ROC
Lines: 32
Message-ID: <41dnav$5cs@news.csie.nctu.edu.tw>
NNTP-Posting-Host: jou%@nematic.ieo.nctu.edu.tw
X-Newsreader: TIN [version 1.2 PL2]

Hello!

	I have a problem about the dynamical library. I compile a program
linking a library and the program which actually doesn't need that library,
I 'ldd' the program, it shows that the program need the library.
	For example, a program , main.c , is shown as following.

void main(void)
{
	printf("Hello World!\n");
	return;
}

	I compile it as 'gcc main.c -o main' then 'ldd main', it shows
that
main:
	-lc.2 => /usr/lib/libc.so.2.1 (0x801b000)

	I compile it as 'gcc main.c -o main -lm -L/usr/X11R6/lib -lX11'
then 'ldd main', it shows that
main:
	-lm.2 => /usr/lib/libm.so.2.0 (0x801b000)
	-lutil.2 => /usr/lib/libutil.so.2.0 (0x8034000)
	-lX11.6 => /usr/X11R6/lib/libX11.so.6.0 (0x8036000)
	-lc.2 => /usr/lib/libc.so.2.1 (0x80b1000)

	Is it normal?
	
	Thanks in advance.

PS. I use FreeBSD-2.0.5-RELEASE.