Here is a simple example.
---
test1.cc
#include
#include
#include
#include
using namespace boost::python;
struct A {
A (int _x) : x (_x) {}
int x;
};
BOOST_PYTHON_MODULE(test1) {
class_ ("A", init());
}
--
test2.cc
#include
#include
#include
#incl
Thanks Scott. I found a very complete example based on that:
http://www.ragestorm.net/samples/empython.zip
Alan Baljeu
- Original Message
From: Scott VanSickle <[EMAIL PROTECTED]>
To: Development of Python/C++ integration
Sent: Monday, November 24, 2008 3:02:20 PM
Subject: Re: [C++
Hi all,
I would like to specify during the class_ declaration use a shared_ptr
with custom release function.
shared_ptr has a constructor where you can pass a function to call in
the release, I would like to use this in a generic form.
I already tried some like that:
shared_ptr _custom_construct
Alan,
We execute Python code in our integration to redirect its stdout; sys.stdout is
the where the output of its print method goes by default. We use a wrapped
Python object on Windows that sends output via OutputDebugString; but you can
send your output wherever you want. You basically just
Alan Baljeu wrote:
I followed the directions there, but that is incomplete. I can printf from C
to the console, but print from Python does nothing. Something in the Python
API must be employed. But perhaps I should take this to the main Python list.
Definitely.
Regards,
Stefan
I followed the directions there, but that is incomplete. I can printf from C
to the console, but print from Python does nothing. Something in the Python
API must be employed. But perhaps I should take this to the main Python list.
Alan Baljeu
- Original Message
From: Renji Panic
maybe this tutorial can help.
http://wiki.python.org/moin/boost.python/EmbeddingPython
On Mon, Nov 24, 2008 at 1:50 AM, fileoffset <[EMAIL PROTECTED]> wrote:
>
> Is it possible to access an object instance from within python?
>
> I am trying to automate a single class that is part of a larger, c
Try this:
main_namespace["instance"] = boost::python::ptr(this);
Assuming you have exposed the class to python, of course.
-/renji
On Mon, Nov 24, 2008 at 10:20 AM, fileoffset <[EMAIL PROTECTED]> wrote:
>
> Is it possible to access an object instance from within python?
>
> I am trying to automa