Fix not loading plugins built against a newer API when Geany doesn't

provide the required version given in PLUGIN_VERSION_CHECK().
Improve documentation for PLUGIN_VERSION_CHECK().



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5051 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2010-06-18 15:04:07 +00:00
parent 980e4c6112
commit de29305a31
4 changed files with 13 additions and 7 deletions

View File

@ -5,6 +5,10 @@
Add ui_combo_box_add_to_history() to API.
* plugins/filebrowser.c:
Add history to path entry.
* src/plugindata.h, src/plugins.c, doc/plugins.dox:
Fix not loading plugins built against a newer API when Geany doesn't
provide the required version given in PLUGIN_VERSION_CHECK().
Improve documentation for PLUGIN_VERSION_CHECK().
2010-06-17 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>

View File

@ -43,7 +43,7 @@
* @section pluginsupport Plugin Support
* - @link howto Plugin HowTo @endlink - get started
* - @link pluginsymbols.c Plugin Symbols @endlink
* - @link plugindata.h Main Datatypes and Macros @endlink
* - @link plugindata.h Plugin Datatypes and Macros @endlink
* - @link signals Plugin Signals @endlink
* - @link pluginutils.h Plugin Utility Functions @endlink
* - @link guidelines Plugin Writing Guidelines @endlink

View File

@ -59,18 +59,20 @@ enum {
GEANY_ABI_VERSION = 66
};
/** Checks the plugin can be loaded by Geany.
/** Defines a function to check the plugin is safe to load.
* This performs runtime checks that try to ensure:
* - Geany ABI data types are compatible with this plugin.
* - Geany sources provide the required API for this plugin. */
* - Geany sources provide the required API for this plugin.
* @param api_required The minimum API number your plugin requires.
* Look at the source for the value of @c GEANY_API_VERSION to use if you
* want your plugin to require the current Geany version on your machine.
* You should update this value when using any new API features. */
#define PLUGIN_VERSION_CHECK(api_required) \
gint plugin_version_check(gint abi_ver) \
{ \
if (abi_ver != GEANY_ABI_VERSION) \
return -1; \
if (GEANY_API_VERSION < (api_required)) \
return (api_required); \
else return 0; \
return (api_required); \
}

View File

@ -468,7 +468,7 @@ plugin_check_version(GModule *module)
"release of Geany - recompile it.", g_module_name(module));
return FALSE;
}
if (result > 0)
if (result > GEANY_API_VERSION)
{
geany_debug("Plugin \"%s\" requires a newer version of Geany (API >= v%d).",
g_module_name(module), result);