unexpected public symbol in .obj for inlined function
Hello,
usually the compiler generates no symbol in the symbol table for an inlined
member.
inline int DerivedClass::function()
{
return 0;
}
But this is not the case in the following sample.
(See below).
where a public (external) symbol is generated.
A problem occurs when the above inline function is included in 2 independent
..cpp files and both .obj files are linked together (e.q. into a dll).
======== ExportTst1.cpp =======
class BaseClass
{
public:
virtual int function()
{
return 123;
}
};
class DerivedClass
: public BaseClass
{
public:
virtual inline int function();
};
template <class Base>
class TemplClass
: public DerivedClass
{
public:
int callFunction();
static inline Base & BaseOf(TemplClass<Base> const &);
static Base * b;
};
template <class Base>
Base * TemplClass<Base>::b = 0;
template <class Base>
int TemplClass<Base>::callFunction()
{
return BaseOf(*this).Base::function();
}
template <class Base>
inline Base & TemplClass<Base>::BaseOf(TemplClass<Base> const &)
{
return *b;
}
inline int DerivedClass::function()
{
return 0;
}
template TemplClass<DerivedClass>;
===============================
to compile:
cl -W4 -nologo -D__WINDOWS__ /LD -c ExportTst1.cpp
dumpbin /SYMBOLS ExportTst1.obj
in a VC++ 8.0 Session.
Note : The Problem flushes when the last statement
template TemplClass<DerivedClass>;
is removed. But i need the explizit template instantation. The original code
is splitted into multiple files (the inline function are in a .inl file,
the template functions are in a .c file, the classes/templates in a .hpp and
the templ. instance is a client.cpp file).
any ideas?
--
mit freundlichen Gr??en/best regards
mario semo