If a header file has a function which is inline and defined in the same file. I read the following in a particular article.
-------------------------------------------------------------------
Usually, classes are declared in header (.h) files. So if mumble.cpp includes foo.h and the compiler decides it has to instantiate CFoo:: GetVal, it will instantiate it as a static function in mumble.cpp. If 10 modules include foo.h, the compiler could generate up to 10 copies of your virtual function. In fact, you could end up with objects of the same type with vtables pointing to different copies of GetVal. Yuk! Some linkers are smart enough to eliminate the redundancies at link time, but in general you can't be sure.
So my question is why would compiler make a particular inline function static while compiling a particular .cpp file , if it includes a header file which has an inline function.
If we use a static function ( not a member of a class) then we usually do not find it in the compiled shared object created from the code( while using nm command on linux) So just trying to figure out is there any correlation between inline and static functions.
static, as used by the article, simply means that the "dummy" function the compiler instantiated in mumble.cpp/mumble.o is not exported from the .o. If it were, then you could easily end up with multiple .o files containing the same instantiation, and the duplicate symbol would result in a linker error. (That's why you don't see the symbol in the 'nm' output -- it is private).