可以在MSVC中使用__declspec(novtable)属性来抑制C++ vtable生成。但是,对于GNU C++编译器来说,there is no equivalent attribute似乎是不合适的。事实是,将vtable留给纯虚拟类不必要地链接到__cxa_abort()和许多其他系统中,我希望避免这种情况发生,因为我是为嵌入式系统编程的。那么,我该怎么做呢?
struct ISomeInterface
{
virtual void Func() = 0;
};
class CSomeClass : public ISomeInterface
{
virtual void Func();
}
void CSomeClass::Func()
{
//...
}发布于 2011-12-04 06:50:11
有一些东西可以实现类似的结果:#pragma interface。
但是,#pragma implementation可以覆盖这一点。
http://www.emerson.emory.edu/services/gcc/html/CPP_Interface.html
https://stackoverflow.com/questions/8371470
复制相似问题