I want to create an app that will be extensible via plugins.
I know that I have 2 options.
I want to use option 2. And I know that I must create a layer for external language to enable communication between this language and my app. But I don't know how to do it. Maybe I must use interprocess communication or something like that.
Let's assume that I have an application written in C++. In the beginning, it may be even a simple console app that displays a few options. And I want to write a plugin in Python like this:
option = "additional option"
myApp.addOption(option)
And then:
I launch my app
My app loads the plugin
I see my app with this additional option displayed
I want to do this simple thing to understand how it works and then I will be able to do something more complicated.
You should be aware that, with care, a C++ library can be called from a C program, mostly by appropriately using extern "C"
to disable name mangling. On Linux, read also the C++ dlopen mini Howto.
Then you need to read the chapter Extending and embedding the Python interpreter
At last, Python is open source, so please study its source code.
I can use one of the existing languages such as Python, Lua or another scripting language.
I strongly recommend considering using GNU Guile or extending Ocaml.
And both TensorFlow or NumPy could inspire you, since they are open source libraries (coded in C and/or C++) usable from Python.