You are not logged in.

#1 2010-03-19 10:00:25

jumzi
Member
Registered: 2009-02-20
Posts: 69

[Solved] Finding gethostname function in gcc

I've started to program some in C after reading dussins of tutorials manuals etc.
But now i want to be able to find out how the functions i use was written in gcc, granted mostly out of nerdy curiosity. As i've understood it the complier is written in C and as such it should somewhere in the source have a function written that's called gethostname() right? The declaration is in a header, sure...  But when i try to grep out the source of gcc4.4.3 i only find a gethostname() function written for fortran, not C.

What am i missing? is all these functions written somewhere else?

Last edited by jumzi (2010-03-19 14:02:13)

Offline

#2 2010-03-19 10:02:46

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,487
Website

Re: [Solved] Finding gethostname function in gcc

That function is provided by glibc.

Offline

#3 2010-03-19 11:24:06

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: [Solved] Finding gethostname function in gcc

GCC is *just* the compiler. It translates human-readable code (well, for a given value of 'readable' tongue) to object (binary) code. gethostname() is in the glibc source.

glibc is the library that provides pretty much everything you'd commonly do in C, hence the name 'GNU C Library'.

Offline

#4 2010-03-19 13:03:09

n0dix
Member
Registered: 2009-09-22
Posts: 956

Re: [Solved] Finding gethostname function in gcc

You can get the source code here

Offline

#5 2010-03-19 14:01:07

jumzi
Member
Registered: 2009-02-20
Posts: 69

Re: [Solved] Finding gethostname function in gcc

Aah! Thanks, been drinking abit this morning... Things tend become messy in the old head thingy :]

Offline

Board footer

Powered by FluxBB