Hi,
I know how to make C++ plugin based application with C++ plugins. I need to add ability to code plugins in Python. I want users to be able to write Plugins in any language (C++ or Python). What are fundamentals of writting app in C++ but support plugins in Python?

I have googled and cannot find something useful yet(may be I use wrong keywords)

Thanks!

Recommended Answers

All 3 Replies

Definitely, go for Boost.Python. It can effectively replace a "plugin system" by just making you C++ code into Python classes and functions. It is seemless, with only a few quirks here and there. Essentially, you can make your C++ class hierarchy be reflected into Python packages, have Python classes derive from them, and then use those derived-class instances from the C++ code. This is basically how it's done.

I prefer to just use Boost.Python as the plugin system, because 99% of what you need to do to create a plugin system is already done by Boost.Python as it exports the classes into Python classes, and the other 1% can easily be done as additional exports. Then, you use Python scripts as the high-level "glue code", with the additional benefit that you can seemlessly mix Python classes, Python classes derived from C++ base classes, and wrapped C++ classes. It is easier to do that work in the Python scripts (e.g., feed an object of a Python class derived from a C++ base class to a wrapped C++ class/function, and the wrapped C++ code won't even see the difference), because loading Python packages and code from C++ code is a lot harder (but possible too).

Well since am the owner of thread and have jumped to the same thing (was postponed) no hurt reviving dead thread :)

I checked Boost Python and its awesome. I want my users to Just put their py code on plugins/python and I want my app (in C++ to just load them). I have two Questions here:
1. Does BoostP act as interpreter for me that I don't need Python DLL?
2. How do I send Events to Py code (I use wxWidgets). I mean how do I make it receive and event being a Python code?

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.