[comp.sys.sgi] using gethostbyname

taylorr@glycine.cs.unc.edu (Russell Taylor) (06/01/90)

	I am trying to use the 'gethostbyname()' system call in a program.
The manual entry mentions that I must link with 'libbsd.a' in order to use
this function.  However, the function is not defined in that library (or
any other library that I can find) and the loader complains about it being
undefined.

	Any clues?
	Russell Taylor
	taylorr@cs.unc.edu

moss@BRL.MIL ("Gary S. Moss", VLD/VMB) (06/01/90)

<         I am trying to use the 'gethostbyname()' system call in a program.
< The manual entry mentions that I must link with 'libbsd.a' in order to use
< this function.  However, the function is not defined in that library (or
< any other library that I can find) and the loader complains about it being
< undefined.

What OS/hardware combination are you running?  I am running 4D/IRIX 3.2.2
and have gethostbyname in *my* /usr/lib/libbsd.a.  (I'm pretty sure it's
been there in previous releases of IRIX).

Try the following:

$ nm -Bo /usr/lib/libbsd.a | grep gethostbyname
...
/usr/lib/libbsd.a:gethostwrap.o:        10000000 T gethostbyname
...

jesse@camelot.sgi.com (Jesse Rendleman) (06/02/90)

In article <14410@thorin.cs.unc.edu> taylorr@glycine.cs.unc.edu (Russell Taylor) writes:
>
>	I am trying to use the 'gethostbyname()' system call in a program.
>The manual entry mentions that I must link with 'libbsd.a' in order to use
>this function.  However, the function is not defined in that library (or
>any other library that I can find) and the loader complains about it being
>undefined.
>
>	Russell Taylor

on my system, "nm /usr/lib/libbsd.a | grep gethostbyname" finds all the
entries you'd expect.

your compile line should be something like "cc prog.c -lbsd -o prog"?

do you have the development option loaded on your machine?  (check
"versions | grep dev", which should say something like...

   I dev                    5900637   Dev Sys PD 3, S5-DV01-3.2, 808-0059-006
   I dev.sw      89/09/06   5800637   Dev Sys SW 3, S5-DV01-3.2, 808-0058-006
   I dev.man     89/09/06   6000637   Dev Sys Man 3, S5-DV01-3.2, 808-0060-006

good luck,