[Developer] init.cc C question
Matthew Warton
mwarton at ok-labs.com
Wed May 9 09:42:04 EST 2007
Hi Jorge,
Jorge Torres wrote:
> *At pistachio/arch/ia32/src/init.cc, there is something like this:
> extern "C" void ............... fname(args..)
> What is the \emph{extern "C") for?
>
extern "C" declares the linkage to use for this function to the
compiler. The specific reason we use it in this fashion is usually to
call a C++ function from assembly. By default C++ creates complex
symbol names for functions, encoding their type as well as their name.
extern "C" forces it to use a simple C style symbol for the function, ie
just "fname".
> *the other: I'm not sure if I understand the l4 generic code works at
> build time:
> Lets say I have a definition A in include/init.h
> then I can transparently use such definition in:
> arch/ia32/src/init.cc, even dou <include/init.h> refers to
> arch/ia32/include/init.h, because at build time; include/ and
> arch/ia32/include/ objects are "binded", right?
>
I am not quite sure if I understand you here, but I will attempt to
explain anyway. The header files in pistachio are located in several
directories depending on whether they are generic, architecture specific
or platform specific. The build process is set up to use the generic,
arch specific and platform specific include directories as include
paths. Thus <init.h> is the generic file "pistachio/include/init.h",
<arch/init.h> is the architecture specific file (in this case
"pistachio/arch/ia32/include/arch/init.h") and <plat/init.h> is the
platform specific header (in this case
"pistachio/platform/pc99/include/plat/init.h")
I hope this answers your questions.
Cheers,
Matthew Warton
More information about the Developer
mailing list