Boost logo

Boost :

Subject: Re: [boost] boost::python help?
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2013-07-19 19:58:25


On 20 July 2013 00:36, David M. Cotter <me_at_[hidden]> wrote:
> i'd like my app to be "available" to python while it's running.
>
> for example, say my app is "FooBar.app".
>
> when my FooBar.app is running, now there is a python interface available to python, and the user can write python scripts to make use of it
> with their scripts, they can control my running application
>
> when FooBar.app is NOT running, perhaps making use of any of the python functions of "FooBar.app" would either return an error, or possibly launch "FooBar.app".
>
> can boost::python help with this?
>
> i've never worked with extending or embedding python, so any help would be super great

I honestly suggest you to read through this chapter thoroughly
and understand it what embedding and extending is
at Python C API level first:

http://docs.python.org/3/extending/index.html

For your use case, you will need to apply the "Extending Embedded Python".

The fact that you want to use Boost.Python is IMHO secondary,
you will simply use convenient C++ API for Python, but it won't
free you completely from understanding how the Python emb/ext
machinery works.

Yes, Boost Python can help with this:

http://wiki.python.org/moin/boost.python/EmbeddingPython
http://members.gamedev.net/sicrane/articles/EmbeddingPythonPart1.html

Best regards,

--
Mateusz  Loskot, http://mateusz.loskot.net

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk