Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-03-28 15:04:31

----- Original Message -----
From: "Karl Bellve" <Karl.Bellve_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, March 28, 2001 1:31 PM
Subject: [boost] C++ Functions not being called from Python....

> From the partial code below, my module is loaded by Python (statically
> linked in my app, as well as BPL). But, it fails when it tries to find
> the function "GetT" using the call PyDict_GetItemString.

That's because GetT is not an attribute of the module imagemangager, but of
the class imagemanager.CImageManager.

Try func = Py_GetAttrString(PyDict_GetItemString(mdict,"CImageManager"),

of course, I don't think that's what you want in this case. you'll need an
object to call the function through. Why bother with the class? Just make
sure CImageManager::GetT is a static member or a free function, and "def" it
directly on the module_builder.

> It also doesn't
> redirect STDIO or STDERR when I put that in a simple
> PyRun_SimpleString(). It is a little harder to check things inside
> Python because I am not making a DLL, so I can't really load the module
> into a python shell and see the STDIO/STDERR, unless I redirect it back
> to my Application.
> Everything compiles fine. Program runs fine but isn't able to call GetT,
> stdout and stderr....

You seem to have lots of problems with your approach, but the first one is
the same mistake that you made above: you're trying to access stdout and
stderr through the imagemanager module whereas they're really defined to the
extension class imagemanager.CImageManager


Boost list run by bdawes at, gregod at, cpdaniel at, john at