Revert "version 2.16.0, PIPluginLoader changes"

This reverts commit f367ef00f7.
This commit is contained in:
2021-03-05 17:29:04 +03:00
parent 22173fe850
commit 7bbbd09f42
3 changed files with 11 additions and 20 deletions

View File

@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0017 NEW) # need include() with .cmake cmake_policy(SET CMP0017 NEW) # need include() with .cmake
project(pip) project(pip)
set(pip_MAJOR 2) set(pip_MAJOR 2)
set(pip_MINOR 16) set(pip_MINOR 17)
set(pip_REVISION 0) set(pip_REVISION 0)
set(pip_SUFFIX ) set(pip_SUFFIX )
set(pip_COMPANY SHS) set(pip_COMPANY SHS)

View File

@@ -234,7 +234,6 @@ PIPluginInfoStorage * PIPluginInfoStorage::instance() {
PIPluginLoader::PIPluginLoader(const PIString & name) { PIPluginLoader::PIPluginLoader(const PIString & name) {
func_loader_version = nullptr; func_loader_version = nullptr;
func_set_user_version = nullptr;
func_static_merge = nullptr; func_static_merge = nullptr;
error = Unknown; error = Unknown;
loaded = false; loaded = false;
@@ -269,17 +268,14 @@ bool PIPluginLoader::load(const PIString & name) {
if (messages) piCout << error_str; if (messages) piCout << error_str;
return false; return false;
} }
int loader_version = func_loader_version(); if (__PIP_PLUGIN_LOADER_VERSION__ != func_loader_version()) {
if (__PIP_PLUGIN_LOADER_VERSION__ != loader_version) {
unload(); unload();
error = InvalidLoaderVersion; error = InvalidLoaderVersion;
error_str = "Load plugin \"" + lib.path() + "\" error: invalid loader version: application = " + PIString::fromNumber(__PIP_PLUGIN_LOADER_VERSION__) error_str = "Load plugin \"" + lib.path() + "\" error: invalid loader version: application = " + PIString::fromNumber(func_loader_version())
+ ", plugin = " + PIString::fromNumber(loader_version); + ", plugin = " + PIString::fromNumber(__PIP_PLUGIN_LOADER_VERSION__);
if (messages) piCout << error_str; if (messages) piCout << error_str;
return false; return false;
} }
func_set_user_version = (FunctionSetUserVersion)lib.resolve(STR(__PIP_PLUGIN_SET_USER_VERSION_FUNC__));
if (func_set_user_version) func_set_user_version();
if (ai->userVersion().size_s() > 1) { if (ai->userVersion().size_s() > 1) {
PIString pversion = pi->userVersion(), lversion = ai->userVersion(); PIString pversion = pi->userVersion(), lversion = ai->userVersion();
if (pversion != lversion) { if (pversion != lversion) {

View File

@@ -68,17 +68,14 @@
#endif #endif
#define __PIP_PLUGIN_LOADER_VERSION_FUNC__ pip_loader_version #define __PIP_PLUGIN_LOADER_VERSION_FUNC__ pip_loader_version
#define __PIP_PLUGIN_SET_USER_VERSION_FUNC__ pip_set_user_version
#define __PIP_PLUGIN_STATIC_MERGE_FUNC__ pip_merge_static #define __PIP_PLUGIN_STATIC_MERGE_FUNC__ pip_merge_static
#define __PIP_PLUGIN_LOADER_VERSION__ 3 #define __PIP_PLUGIN_LOADER_VERSION__ 2
#define PIP_PLUGIN_SET_USER_VERSION(v) \ #define PIP_PLUGIN_SET_USER_VERSION(v) \
extern "C" { \ STATIC_INITIALIZER_BEGIN \
PIP_PLUGIN_EXPORT void __PIP_PLUGIN_SET_USER_VERSION_FUNC__() { \
PIPluginInfo * pi = PIPluginInfoStorage::instance()->currentInfo(); \ PIPluginInfo * pi = PIPluginInfoStorage::instance()->currentInfo(); \
if (pi) pi->setUserVersion(v); \ if (pi) pi->setUserVersion(v); \
} \ STATIC_INITIALIZER_END
}
#define PIP_PLUGIN_ADD_STATIC_SECTION(type, ptr) \ #define PIP_PLUGIN_ADD_STATIC_SECTION(type, ptr) \
STATIC_INITIALIZER_BEGIN \ STATIC_INITIALIZER_BEGIN \
@@ -145,7 +142,6 @@ private:
class PIP_EXPORT PIPluginLoader { class PIP_EXPORT PIPluginLoader {
public: public:
typedef int(*FunctionLoaderVersion)(); typedef int(*FunctionLoaderVersion)();
typedef void(*FunctionSetUserVersion)();
typedef void(*FunctionStaticMerge)(int, void *, void *); typedef void(*FunctionStaticMerge)(int, void *, void *);
//! Possible load plugin error //! Possible load plugin error
@@ -206,7 +202,6 @@ private:
PILibrary lib; PILibrary lib;
FunctionLoaderVersion func_loader_version; FunctionLoaderVersion func_loader_version;
FunctionSetUserVersion func_set_user_version;
FunctionStaticMerge func_static_merge; FunctionStaticMerge func_static_merge;
PIString error_str; PIString error_str;
Error error; Error error;