Boost.Python: is my code safe?
I have a question regarding the use of Boost.Python. What I would like
to do is to provide a simple scripting interface to an application in
much the same way as Microsoft use Visual Basic within much of their
product line (e.g. Excel) to provide direct access to the applications
object model.
My design is stunningly rendered below,
+-------------------------+
| Application--+ |
| | | Dynamically +---------------+
| v | Linked | Python Module |
| +--->ObjectModel<------------------| |
| | | +---------------+
| +---------------------+ | |
| | Python Interpretter |<----------------------+
| | | | ">>> import ..."
| +---------------------+ |
+-------------------------+
What we have firstly is a our python module, in this case it exports a
simple class 'ObjectModel' with various functions, sub objects and
whatever else is required for the application to run. This is our Object
Model, and is usable from the python interpretter on the command line.
For what we have in mind however is for the python interpretter to be
running inside the application (through use of the Py* functions from
the python API and use of the relevant parts of Boost.Python - handle<>,
object).
What I want is for the application and the python instance to share the
object model, for the interpretter to have knowledge of the ObjectModel
it is simply imported from the python module. The application itself is
linked against the python module in order to use ObjectModel (the
relevant compiler specific code is inserted so that the ObjectModel
class is exported/imported - __declspec(dllexport) and dllimport under
Visual C++).
With this setup, it is now possible to create an instance of ObjectModel
within the python interpretter and use extract
participants (1)
-
Matthew Bray