📄 pluginprober.cpp
字号:
/*
* Copyright (c) 2005 Zhejiang University, P.R.China
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
//=============================================================================
/**
* \file Utility/PluginProber.cpp
*
* $Id: PluginProber.cpp,v 1.2 2005/03/16 06:53:59 kehc Exp $
*
* \author Huacheng Ke <sese_zju@yahoo.com.cn>
*/
//=============================================================================
#include "stdafx.h"
#include <Core/Dll.h>
#include <Core/System.h>
#include <Core/Board.h>
#include <Core/Helper.h>
#include <iostream>
#include <cstdio>
int _tmain(int argc, _TCHAR* argv[])
{
std::cout<<"==================================================="<<std::endl;
std::cout<<" PluginProber: Wukong Plugin Probing Utility "<<std::endl;
std::cout<<" Author: Huacheng Ke <sese_zju@yahoo.com.cn>"<<std::endl;
std::cout<<" Licensed under GPL, ABSOLUTELY NO WARRANTY"<<std::endl;
std::cout<<"==================================================="<<std::endl;
std::string home = Core::Host_Machine::get_wukong_home();
if (home != "")
std::cout<<"$(WUKONG_HOME) = "<<home<<std::endl;
else
{
std::cout<<"$(WUKONG_HOME) not set, program will exit."<<std::endl;
exit(1);
}
std::cout<<"Searching plugins in:\n "<<Core::Host_Machine::get_plugin_path()<<std::endl<<std::endl;
std::vector<std::string> dlls;
Core::Host_Machine::get_plugin_files(dlls);
std::vector<std::string> splited;
for (size_t i = 0; i < dlls.size(); ++i)
{
Core::Host_Machine::split_full_path(dlls[i], splited);
std::cout<<"Find "<<splited[1] + "." + splited[2];
if (Core::Host_Machine::is_debug_version(dlls[i]))
std::cout<<" (DEBUG Version)"<<std::endl;
else
std::cout<<" (RELEASE Version)"<<std::endl;
std::cout<<" Probing Symbol - ["<<Core::MODULE_CREATE_FUNC_NAME<<"].......";
if (Core::DLL_Manager::test_symbol(dlls[i], Core::MODULE_CREATE_FUNC_NAME))
std::cout<<"TRUE"<<std::endl;
else
std::cout<<"FALSE"<<std::endl;
std::cout<<" Probing Symbol - ["<<Core::MODULE_DESTROY_FUNC_NAME<<"]......";
if (Core::DLL_Manager::test_symbol(dlls[i], Core::MODULE_DESTROY_FUNC_NAME))
std::cout<<"TRUE"<<std::endl;
else
std::cout<<"FALSE"<<std::endl;
std::cout<<" Probing Symbol - ["<<Core::MODULE_ENUM_FUNC_NAME<<"].........";
Core::DLL * dll = Core::DLL_Manager::load(dlls[i]);
Core::Module_Enum_Func func;
func = (Core::Module_Enum_Func) dll->get_symbol(Core::MODULE_ENUM_FUNC_NAME);
if (func)
{
std::cout<<"TRUE"<<std::endl;
std::vector<Core::Module_Meta> res;
std::cout<<" Following modules are found inside:\n ";
func(res);
for (size_t j = 0; j < res.size(); ++j)
{
std::cout<<"["<<res[j].name<<"] ";
}
std::cout<<std::endl;
}
else
{
std::cout<<"FALSE"<<std::endl;
}
std::cout<<std::endl;
}
std::cout<<"Press Return to exit.";
getchar();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -