undefined reference to... when calling an inline function in a shared library

Ian Lance Taylor iant@google.com
Wed Sep 9 14:55:00 GMT 2009


"John (Eljay) Love-Jensen" <eljay@adobe.com> writes:

>> How can I expose an inline function WITHOUT implementing it in the
>> header file?
>
> You can't.

Technically, you can, by using "extern inline".  But I agree that
putting the inline function in a header file is normally what you want.

The "inline" keyword is C++ does not, as many people assume, direct the
compiler to inline the function.  What it actually does is change the
linkage of the function.  C++ has three kinds of linkage for functions:
extern, static, and inline.

Ian



More information about the Gcc-help mailing list