avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] link problems


From: Parthasaradhi Nayani
Subject: Re: [avr-gcc-list] link problems
Date: Tue, 8 Mar 2005 23:26:43 -0800 (PST)

Hello Enrico,

The compiler while compiling the code, does not really
know/bother about the availability of functions. It
assumes that the functions are available and only
inserts calls to these functions wherever a function
is called. The compiler does not put in the address of
the function that is being called. It is the
responsibility of the linker to resolve these
addresses. Consequently you get errors from the linker
when it does not find the called function either in
the obj files or in the libraries that are given to
the linker.

For cli(), you might get a warning from the compiler
that it is not able to see the prototype (if you dont
include the interrupt.h file, but the linker should
not give you any error for this function as I guess it
to be a part of the standard library.

Please rememeber, if function protos are not made
available to compiler, it assumes that the function
returns a type int and if this does not match the
return type in the function, the compiler cries foul!!

Sorry for a long mail. Cheers

Nayani







--- "address@hidden"
<address@hidden> wrote:
> 
> However, if the functions are deprecated and not
> anymore in the library: how
> comes the code compiles? (but does not link..)
> 
> I also noticed another weird thing (weird to me)
> regarding the function cli() -
> which seems to be defined in interrupt.h
> If I only include avr/io.h the code compiles (!!)
> but I get link errors.
> If I also include avr/interrupt.h the code compiles
> and link fine.
> 
> I would expect the error to appear at the
> compilation step (with the complier
> complaining about cli not being declared).
> 
> I am confused.
> Is this normal? (in which case I'd be grateful if
> someone could please explain
> me how comes the compiler doesn't complain about the
> non-declared function)
> Is this a bug?
> Or deos it just mean that there is something wrong
> in the way I have installed
> the tookchain?
> 



        
                
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]