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

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

[avr-gcc-list] Inline attribute


From: Ron
Subject: [avr-gcc-list] Inline attribute
Date: Tue, 21 Nov 2006 23:52:58 +1100

Hi Folks,

How do you declare an external function inline when it is used in a
number of different files? For example, if I define the function in a
header as:

inline void __attribute__ ((always_inline)) RestoreState(STATE_REG ps)
{
   SREG = ps;
}

I get multiple definition errors when it is invoked in other files. If I
define just the prototype in the header:

inline void __attribute__ ((always_inline)) RestoreState(STATE_REG ps);

and define the function in a corresponding C file as:

inline void RestoreState(STATE_REG ps)
{
   SREG = ps;
}

gcc complains it cannot find the function body when it is invoked in
other files. I have tried various forms of the inline syntax with no
change to the error message. 

Ron






reply via email to

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