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

Tim Sutton lists at linfiniti.com
Fri Feb 25 15:33:24 EST 2011


Hi

On Fri, Feb 25, 2011 at 7:28 PM, Barend Gehrels <barend at xs4all.nl> wrote:
> Hi,
>
> I'm quite new to this list so sorry if I say something that has been
> discussed already or if I miss a point.
>
> On 25-2-2011 10:03, Martin Dobias wrote:
>>
>> While custom paths for c++ plugins seems to be a nice feature, I would
>> like to point out the problems it will bring at some point: imagine
>> that you compile a plugin for qgis 1.6 and keep it in this custom
>> directory. Some time later you upgrade qgis to 1.7. The qgis libraries
>> are not binary compatible between the releases,
>
> Is the plugin-API documented somewhere? Cannot find it. I find this:
>
> http://www.qgis.org/wiki/Writing_C%2B%2B_Plugins
>
> having a note that it is quite old.

The best is to look at src/gui/qgisinterface.h which shows the various
methods and objects available to the api. You can also manipulate the
main window app from within you plugin via qGisInterface->mainWindow()

>
>
> 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

>
>
>> so there is a good
>> chance that the plugin will cause some random instabilities - it might
>> crash qgis on some actions or even cause qgis to fail to start.
>
> Agreed
>
>> I would strongly recommend the users willing to write 3rd party
>> plugins for QGIS to do that in Python - it's faster to implement, not
>> required to compile and much easier to distribute.
>
> I don't understand this:
> - if the API/ABI changes, then you might have (sometimes) the same problem
> with Python (don't know sip).

We maintain backwards compatibility for API. So if a method name
changes for example the old name must remain as a wrapper for the new
method. Old methods are marked as deprecated in the docs and in major
releases (e.g. upcoming 2.0) we will shed deprecated methods from the
API.

Because we use C++ ABI compatibility is not possible between versions.
This doesnt affect python (as the plugins only need the same language
binding elements to be present) so it is an advantage for python that
its not vulnerable to lib updates.

> - faster to implement but C++, in general, runs faster. If I've write
> labelling or routing plugin -> I would prefer C++

Yes C++ is good for performance sensitive code, or where you need to
make use of additional libs that are in C++.

> - some people knew C++ better, some Python, some both, if there are two
> options, would one be deprecated?

Not likely we are with both for the long term I think it is safe to say.

> - why easier to distribute?

As Charlie mentions in the next email, python plugins dont need to be
compiled for specific platforms, just write once, run everywhere.

Despite Martin's comments I think the plugin paths addition to options
(I'll move it into advanced options on the next options dialog
cleanup) can be handy for testing plugins and on multiuser systems
where plugins need to be shared but can't necessarily be put into the
system plugins dir because of IT policy etc.

Regards

Tim

>
> Regards, Barend
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>



-- 
Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Visit http://linfiniti.com to find out about:
 * QGIS programming and support services
 * Mapserver and PostGIS based hosting plans
 * FOSS Consulting Services
Skype: timlinux
Irc: timlinux on #qgis at freenode.net
==============================================


More information about the Qgis-developer mailing list