Re: header file in C
From: Malcolm (malcolm_at_55bank.freeserve.co.uk)
Date: 10/18/04
- Next message: Mark McIntyre: "Re: ...malloc ...from Rome...and Big Chris"
- Previous message: Chris Torek: "Re: c equivalence of const_cast?"
- In reply to: candy: "header file in C"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 18 Oct 2004 22:32:51 +0100
"candy" <candy_init@yahoo.com> wrote
>
> I just want to know that whether the C header files( like stdio.h,etc
> which the compiler provides) just contains the function declarations
> or they also contain some additionalinformation like where to look in
> the memory for the defintions of the standard functions like
>
If you look at a standard header file by opening it in an editor, you'll
probably find something that looks superficially like gibberish, but when
you examine it closely is a regular C header.
However not all implementations are like this. The compiler isn't required
to have standard headers as actual files.
As for "finding the function in memory", all library or object file
functions need to be located somehow. The standard libary is no different.
>
> scanf(char*c,...)).
>
> Also,if there is no information about the location of the memory where
> the definitions of the standard functions is present,then can we just
> declare the function which we want to use,ourselves,and then don't
> include the required header file/s.
>
This will probably work, and language lawyers will be able to tell you
whether or not behaviour is defined. However for practical purposes we never
do this. If scanf() is available then stdio.h will also be available, and so
is always included.
>
> Also,can you please tell me the steps in brief through which a typical
> complier passes the source file so as to generate the final executable
> file.
>
It first runs the C preprocessor on the file. Then it compiles all the
function definitions to an intermediate format, known as object code, then
it invokes the linker to join the object files and library files into an
executable.
>
> Also,can you please tell me that why an executable file made in Windows
> operating system is not recognised by the Linux operating System and
> vice-versa.
>
Through wickedness. The processors are the same, and so the machine code is
basically identical. However the operating system writers have decided to
make the minor loading and initialisation code incompatible, so programs
won't run on each other's platforms and lawsuits / competition is avoided.
- Next message: Mark McIntyre: "Re: ...malloc ...from Rome...and Big Chris"
- Previous message: Chris Torek: "Re: c equivalence of const_cast?"
- In reply to: candy: "header file in C"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|