[Qgis-developer] Plugin Development C++ Windows - Any response?

Martin Dobias wonder.sk at gmail.com
Sun Feb 27 16:01:57 EST 2011


On Sat, Feb 26, 2011 at 12:52 PM, Barend Gehrels <barend at xs4all.nl> wrote:
>>> I can imagine the API is not binary compatible for some upgrades (usually
>>> it
>>> is extended so then still compatible, depending on the model used). Is
>>> there
>>> not a mechanism to check if a plugin corresponds to the version of the
>>> host
>>> (qgis)? I think this is feasable...
>>
>> Yes the version is available within the QGIS namespace: QGis::QGIS_VERSION
>
> What I mean is this: adding one method to QgisPlugin, e.g.:
> virtual int interfaceVersion() = 0;
>
> which gives back a interface_version_number. That number only changes if the
> (plugin) interface changes. QGis can check if the plugin does implement the
> right interface.
>
> But I now understand better that if the plugin calls back the qgis API, also
> that interface has to be stable. So in practice this will indeed change with
> every version. But anyway, even then, qgis can check that number as its
> first action and discard that plugin if the interface_version_number is
> wrong.

Exactly. This is something that should be added and checked in order
to avoid possible crashes after upgrades. Even better would be to make
it a global function in each plugin since that would avoid creation of
a new instance of that plugin which could actually make some calls to
qgis api. I would call that method e.g. 'requiredQgisVersion' and it
would always QGis::QGIS_VERSION - i.e. version of qgis used when
compiling the plugin.

Martin


More information about the Qgis-developer mailing list