aoloe / cpp-pybind11-playground

Creating a Scripting Egnine with pybind11. Step by step. https://github.com/pybind/pybind11
35 stars 9 forks source link

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

Open aoloe opened 6 years ago

aoloe commented 6 years ago

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...

aoloe commented 6 years ago

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

aoloe commented 6 years ago

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

it might also be the only sane way...

aoloe commented 6 years ago

this revision has code that works with raw pointers:

https://github.com/aoloe/cpp-pybind11-playground/tree/51f00ad6964ecbe5de896e92bdc0936ef2fbeb14