PIPluginLoader lib lastError
This commit is contained in:
@@ -217,7 +217,10 @@ PIPluginLoader::~PIPluginLoader() {
|
|||||||
|
|
||||||
bool PIPluginLoader::load(const PIString & name) {
|
bool PIPluginLoader::load(const PIString & name) {
|
||||||
unload();
|
unload();
|
||||||
if (!lib.load(findLibrary(name))) return false;
|
if (!lib.load(findLibrary(name))) {
|
||||||
|
piCout << "Load plugin \"" << name << "\"load failed with error: " << lib.lastError().trimmed();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
//piCout << "loading" << lib.path() << "...";
|
//piCout << "loading" << lib.path() << "...";
|
||||||
func_loader_version = (FunctionLoaderVersion)lib.resolve(STR(__PIP_PLUGIN_LOADER_VERSION_FUNC__));
|
func_loader_version = (FunctionLoaderVersion)lib.resolve(STR(__PIP_PLUGIN_LOADER_VERSION_FUNC__));
|
||||||
if (!func_loader_version) {
|
if (!func_loader_version) {
|
||||||
@@ -253,8 +256,7 @@ bool PIPluginLoader::load(const PIString & name) {
|
|||||||
func_static_merge = (FunctionStaticMerge)lib.resolve(STR(__PIP_PLUGIN_STATIC_MERGE_FUNC__));
|
func_static_merge = (FunctionStaticMerge)lib.resolve(STR(__PIP_PLUGIN_STATIC_MERGE_FUNC__));
|
||||||
if (func_static_merge) {
|
if (func_static_merge) {
|
||||||
auto pss = plugin_info->staticSections(true), lss = PIPluginInfo::instance()->staticSections(false);
|
auto pss = plugin_info->staticSections(true), lss = PIPluginInfo::instance()->staticSections(false);
|
||||||
piCout << lss.keys() << pss.keys();
|
//piCout << lss.keys() << pss.keys();
|
||||||
|
|
||||||
auto it = lss.makeIterator();
|
auto it = lss.makeIterator();
|
||||||
while (it.next()) {
|
while (it.next()) {
|
||||||
if (!pss.contains(it.key()))
|
if (!pss.contains(it.key()))
|
||||||
@@ -286,6 +288,11 @@ PIString PIPluginLoader::libPath() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PIString PIPluginLoader::lastError() {
|
||||||
|
return lib.lastError();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void * PIPluginLoader::resolve(const char * name) {
|
void * PIPluginLoader::resolve(const char * name) {
|
||||||
if (!loaded) return nullptr;
|
if (!loaded) return nullptr;
|
||||||
return lib.resolve(name);
|
return lib.resolve(name);
|
||||||
|
|||||||
@@ -150,6 +150,9 @@ public:
|
|||||||
//! Returns loaded plugin library path
|
//! Returns loaded plugin library path
|
||||||
PIString libPath();
|
PIString libPath();
|
||||||
|
|
||||||
|
//! Returns library lastError
|
||||||
|
PIString lastError();
|
||||||
|
|
||||||
//! Resolve symbol "name" from plugin library
|
//! Resolve symbol "name" from plugin library
|
||||||
void * resolve(const char * name);
|
void * resolve(const char * name);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user