Inter plugin communication

Alexander Dymo adymo at
Fri May 20 22:45:40 UTC 2005

On Friday 20 May 2005 13:25, Andras Mantia wrote:
>  I'm having some problems with KDevelop interfaces. ;-) The main problem
> is that I don't know how can I communicate between two plugins. Here
> are two examples:
> 1) Let's have a global plugin called A which wants to print out some
> text to a message view. We have plugin B, which is a message-view
> plugin who is able to process some text and print it out in a nice
> form. Plugins A and B are completely independent, plugin A should
> compile without plugin B being present and vice versa.
> Taking the above into the account, how can:
> - plugin A send some data to plugin B?
> - plugin A request the showing of the main widget of plugin B?

The similar solution exists using KDevelop "extension plugin" mechanism.
You create a shared library libmyshared with two abstract classes in it:
class AIface: public KDevPlugin {
... //interface pure virtual methods
class BIface: public KDevPlugin {
... //interface pure virtual methods
and define a service type 
[Desktop Entry]

[Desktop Entry]

Then you link both plugins to the same shared library and use 
KDevPlugin::extension method to query and execute methods:
AIface *a = extension<A>("KDevelop/AIface");
if (a) a->doSmth();

BIface *b = extension<B>("KDevelop/BIface");
if (b) b->doSmth();

See KDevPlugin::extension method documentation;

> I'm afraid this won't work without creating another KDevelop interface
> for "message-view" style plugins, am I right?
> If it is so, I think we will need this and possibly more such
> interfaces. Am I allowed to add those to the platform?
Extension interfaces do not need to be a part of the platform, you can define
them everywhere else.

Alexander Dymo
ICST Department, National University of Shipbuilding, Mykolayiv, Ukraine

More information about the KDevelop-devel mailing list