Skip to main content
Visitor II
September 14, 2006
Question

inline functions

  • September 14, 2006
  • 4 replies
  • 3227 views
Posted on September 14, 2006 at 10:56

inline functions

    This topic has been closed for replies.

    4 replies

    ewittAuthor
    Visitor II
    September 14, 2006
    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.

    Visitor II
    September 14, 2006
    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.

    ewittAuthor
    Visitor II
    September 14, 2006
    Posted on September 14, 2006 at 07:27

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

    Visitor II
    September 14, 2006
    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.