Embedding Python in C++

P

Pecks

Hi,

I'm having problems embedding Python in C++.
(Background - I'm hacking a COTS app
written in C++, and I'd like to write in some intelligence in
Python)

I understand that I can call a python objects method
using PyImport_ImportModule, PyObject_GetAttrString and
PyObject_CallMethod.

But this method relies on the object being declared and initialsed
within my Python code. It also depends on hard-coding the name
of the python object in the C++ code, which is nasty.

Is there a better way of doing this?
Is it necessary / a good idea to use Boost or Swig?
I'd rather code it by hand using the Python C API if possible.

Thanks,

Greg.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,176
Messages
2,570,950
Members
47,503
Latest member
supremedee

Latest Threads

Top