开源服务器框架NoahFrame分享 第二章:插件与模块

2017-10-31

return mInst != NULL;

}

bool UnLoad()

{

DYNLIB_UNLOAD(mInst);

return true;

}

const std::string& GetName(void) const

{

return mstrName;

}

const bool GetMain(void) const

{

return mbMain;

}

void* GetSymbol(const char* szProcName)

{

return (DYNLIB_HANDLE)DYNLIB_GETSYM(mInst, szProcName);

}

protected:

std::string mstrName;

bool mbMain;

DYNLIB_HANDLE mInst;

};

然后NFCPluginManager::Awake()函数在调用的时候,会先调用LoadPluginConfig()函数来动态库通过查找Plugin.xml内部配置的插件列表来加载需要的插件:

bool NFCPluginManager::LoadPluginConfig()

{

std::string strContent;

GetFileContent(mstrConfigName, strContent);

rapidxml::xml_document<> xDoc;

xDoc.parse<0>((char*)strContent.c_str());

rapidxml::xml_node<>* pRoot = xDoc.first_node();

rapidxml::xml_node<>* pAppNameNode = pRoot->first_node(mstrAppName.c_str());

if (!pAppNameNode)

{

NFASSERT(0, "There are no App ID", __FILE__, __FUNCTION__);

123456阅读全文

相关游戏

最新合集

相关文章

网友评论

    加载更多
    回复 [1楼 ]取消回复