cancel
Showing results for 
Search instead for 
Did you mean: 

inline functions

ewitt
Associate II
Posted on September 14, 2006 at 10:56

inline functions

4 REPLIES 4
ewitt
Associate II
Posted on September 14, 2006 at 07:08

Hi!

I wondered how I can compile inline functions with armcc.

I tried

Code:

inline void whatever();

and

Code:

static inline void whatever();

I call the function with

Code:

whatever();

But when i try to compile the project i get an linker error:

Undefined symbol whatever (referred from 71x_it.o)...

What's wrong. How do I make use of inline wiht armcc?

regards,

E.

kleshov
Associate II
Posted on September 14, 2006 at 07:19

Obviously, an inline function has to be defined in the same compilation unit (source file) where it is called. That's why they are often put into header files.

ewitt
Associate II
Posted on September 14, 2006 at 07:27

oh, i didnt know that, thanks! Does every compiler handle this so?

kleshov
Associate II
Posted on September 14, 2006 at 10:56

Yes, they do.

Think about it. It's the compiler's job to do function inlining. In order to do that, it has to see the functions's definition. The compiler can see only one source file at a time. That's where the limitation comes from.