kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #38754
Re: Plugin in C++
Hi,
There is also a description of how you would write a tool in the development documentation: http://docs.kicad-pcb.org/doxygen/md_Documentation_development_tool-framework.html
As Thomas said, there is no pluggable C++ interface for plugins. Part of the reason for this is that C++ does not provide a stable ABI for the plugin to communicate over. This means all plugins need to be compiled in the same way as kicad, which puts a damper on sharing plugins easily. This is essentially what the SWIG build process: use the ABI to the currently compiled kicad, wrap it and pass it on to Python. This is why it needs to be compiled in. An alternative is to pass info over a strict C interface (maybe using some kind of object serialisation or library) or some other method like Dbus or sockets, which are not very portable.
In principle, there could be a C++ plugin system too, but it would cause some heartache when ABIs don't match (you can't just download a plugin, you'll need to ensure it's compiled for your kicad).
Again in principle, a C++ plugin interface would possibly be a good idea for many tools anyway, even only internally, to encourage access to the internal data structures in a consistent and concurrent way. At that point, third party plugins could theoretically hook in too (if the ABI is ok).
Cheers,
John
On 31 December 2018 17:17:06 GMT, Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx> wrote:
>On 31/12/2018 17:54, mdoesbur@xxxxxxxxx wrote:
>> I've seen it is possible to write action plugins in python, I would
>> rather do this kind of stuff in C++. In the sources I've found only
>some
>> file loaders/savers and 3D stuff. Is the kind of plugin like
>"replicate
>> layout" possible from C++? And if it is, is there some kind of
>example?
>>
>
>Hi,
>
>There is no possibility to write action plugins in C++, but you can
>just
>contribute a 'regular' KiCad tool. Have a look at
>EDIT_TOOL::CreateArray
>sources for a starting point.
>
>Regards,
>Tom
>
>_______________________________________________
>Mailing list: https://launchpad.net/~kicad-developers
>Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
>Unsubscribe : https://launchpad.net/~kicad-developers
>More help : https://help.launchpad.net/ListHelp
References