aoloe / cpp-pybind11-playground

Creating a Scripting Egnine with pybind11. Step by step. https://github.com/pybind/pybind11

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sharing the document between the c++ application, the API and the python script

aoloe opened this issue · comments

  • the c++ application might or not have an open document.
  • if there is an open document, it's shared with the API.
  • the API can modify the document.
  • while the script is running, the C++ application is not allowed to modify the document(s).
  • (eventually, trough the API it should be possible to change the current document to any other open document)
  • through the API, it should be possible to open documents / create new documents.
  • (eventually, the document will be left open when the script is finished)

in https://github.com/aoloe/cpp-pybind11-playground/tree/master/scripter-api i have a Sample::Document which is the document in the Sample C++ application and a ScripterAPI::Document which will be used to create the module for Python.

i'm now looking for a good (modern) way of managing the sharing of the Sample::Document...

passing a reference is not possible, since there might not be a document.

the most straight forward way seems to be to pass a raw pointer.

it might also be the only sane way...