On 24 Dec 2008, at 00:15, William Newbery wrote:

> Cannot be done. Python can only call C code that meets its API 
> specification. C++ loses on two counts its not C and its not python API.

I think you missed what I meant. I dont want python to touch that stuff, I want it only for other c++ objects in the same project ie:

class Direct3D : public Py::ExtensionObject<Direct3D>
{
...
    Py::Object Render(const Py::Tuple &args);//--- method for use by python
...
    IDirect3DDevice9* GetDevice();//--- ONLY used by other c++ objects in this project, like say the sprite class that needs to do: "d3d->GetDevice()->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2)" etc
};

So basicly what I'm saying is that within the c++ code can I use the Direct3D* object directly, and ignore the python stuff all together except for maintaining the refrence count so it cant get deleted while its still used by c++ objects. I dont want python to even know about the GetDevice method and IDirect3DDevice9 interface, thats soley for internal use by my c++ project.

The error you made was not letting Python handle the ref counting. Fix that as I suggested and you will be good.

If you have private objects that Python does not need to see manage them in C++ way.

Barry