@@ -466,52 +466,56 @@ int main(int argc, char** argv)
466466 }
467467 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X (" 启动服务中,初始化插件系统成功,开始加载插件" ));
468468 // 枚举插件
469+ int nListCount = 0 ;
469470 int nLibCount = 0 ;
470471 XCHAR** pptszListFile;
471- SystemApi_File_EnumFileA (st_ServiceConfig.st_XPlugin .tszLibPlugin , &pptszListFile, &nLibCount , false , 1 );
472- for (int i = 0 ; i < nLibCount ; i++)
472+ SystemApi_File_EnumFileA (st_ServiceConfig.st_XPlugin .tszLibPlugin , &pptszListFile, &nListCount , false , 1 );
473+ for (int i = 0 ; i < nListCount ; i++)
473474 {
474475 XCHAR tszFileExt[64 ] = {};
475476 BaseLib_String_GetFileAndPath (pptszListFile[i], NULL , NULL , NULL , tszFileExt);
476477 if (0 == _tcsxnicmp (tszFileExt, _X (" dll" ), 3 ) || 0 == _tcsxnicmp (tszFileExt, _X (" so" ), 2 ) || 0 == _tcsxnicmp (tszFileExt, _X (" dylib" ), 5 ))
477478 {
479+ nLibCount++;
478480 // 加载插件
479481 if (ModulePlugin_Loader_Insert (pptszListFile[i], 0 , &st_PluginParam))
480482 {
481483 XCHAR tszModuleName[128 ] = {};
482484 XCHAR tszModuleAuthor[64 ] = {};
483485 XCHAR tszModuleVer[64 ] = {};
484486 ModulePlugin_Loader_GetForModule (pptszListFile[i], tszModuleName, tszModuleVer, tszModuleAuthor);
485- XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X (" 启动服务中,加载Lib模块插件中,当前第:%d 个加载成功,路径:%s,方法名:%s,作者:%s,版本:V%s" ), i , pptszListFile[i], tszModuleName, tszModuleAuthor, tszModuleVer);
487+ XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X (" 启动服务中,加载Lib模块插件中,当前第:%d 个加载成功,路径:%s,方法名:%s,作者:%s,版本:V%s" ), nLibCount , pptszListFile[i], tszModuleName, tszModuleAuthor, tszModuleVer);
486488 }
487489 else
488490 {
489- XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" 启动服务中,加载Lib模块插件中,当前第:%d 个加载失败,路径:%s,错误:%lX" ), i , pptszListFile[i], ModulePlugin_GetLastError ());
491+ XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" 启动服务中,加载Lib模块插件中,当前第:%d 个加载失败,路径:%s,错误:%lX" ), nLibCount , pptszListFile[i], ModulePlugin_GetLastError ());
490492 }
491493 }
492494 }
493- BaseLib_Memory_Free ((XPPPMEM)&pptszListFile, nLibCount );
495+ BaseLib_Memory_Free ((XPPPMEM)&pptszListFile, nListCount );
494496
495497#if (1 == _XENGINE_BUILD_SWITCH_LUA)
498+ nListCount = 0 ;
496499 int nLuaCount = 0 ;
497500 XCHAR tszFileExt[64 ] = {};
498- SystemApi_File_EnumFileA (st_ServiceConfig.st_XPlugin .tszLuaPlugin , &pptszListFile, &nLuaCount , false , 1 );
499- for (int i = 0 ; i < nLuaCount ; i++)
501+ SystemApi_File_EnumFileA (st_ServiceConfig.st_XPlugin .tszLuaPlugin , &pptszListFile, &nListCount , false , 1 );
502+ for (int i = 0 ; i < nListCount ; i++)
500503 {
501504 BaseLib_String_GetFileAndPath (pptszListFile[i], NULL , NULL , NULL , tszFileExt);
502505 if (0 == _tcsxnicmp (tszFileExt, _X (" lua" ), 3 ))
503506 {
507+ nLuaCount++;
504508 if (ModulePlugin_Loader_Insert (pptszListFile[i], 1 , &st_PluginParam))
505509 {
506510 XCHAR tszModuleName[128 ] = {};
507511 XCHAR tszModuleAuthor[64 ] = {};
508512 XCHAR tszModuleVer[64 ] = {};
509513 ModulePlugin_Loader_GetForModule (pptszListFile[i], tszModuleName, tszModuleVer, tszModuleAuthor);
510- XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X (" 启动服务中,加载Lua模块插件中,当前第:%d 个加载成功,路径:%s,方法名:%s,作者:%s,版本:V%s" ), i , pptszListFile[i], tszModuleName, tszModuleAuthor, tszModuleVer);
514+ XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X (" 启动服务中,加载Lua模块插件中,当前第:%d 个加载成功,路径:%s,方法名:%s,作者:%s,版本:V%s" ), nLuaCount , pptszListFile[i], tszModuleName, tszModuleAuthor, tszModuleVer);
511515 }
512516 else
513517 {
514- XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" 启动服务中,加载Lua模块插件中,当前第:%d 个加载失败,路径:%s,错误:%lX" ), i , pptszListFile[i], ModulePlugin_GetLastError ());
518+ XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" 启动服务中,加载Lua模块插件中,当前第:%d 个加载失败,路径:%s,错误:%lX" ), nLuaCount , pptszListFile[i], ModulePlugin_GetLastError ());
515519 }
516520 }
517521 }
0 commit comments