|
InterfaceReg链表用于CreateInterface()返回特定的接口。
但是InterfaceReg是如何初始化的?
看来起作用的只有EXPOSE_INTERFACE
#define EXPOSE_INTERFACE(className, interfaceName, versionName) \
static void* __Create##className##_interface() {return (interfaceName *)new className;}\
static InterfaceReg __g_Create##className##_reg(__Create##className##_interface, versionName );
如果我写一句:
EXPOSE_INTERFACE(CMyClass, IMyClass, "MyName");
应该宏扩展成:
static void* __CreateCMyClass_interface()
{
return (IMyClass *) new CMyClass;
}
static InterfaceReg __g_CreateCMyClass_reg(__CreateCMyClass_interface, "MyName" );;
这样有什么用?
InterfaceReg是否因此添加了一项
{"MyName", __CreateCMyClass_interface}?
难道末尾的双分号不会出错?
第二个static语句定义了什么东西?
|
|