<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>This has been asked many times, in many variants,
but I cannot seem to get this working in any shape or form, which leads me to
believe I'm doing something numbskulled.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I'm trying to perform this sequence of
events:</FONT></DIV>
<DIV><FONT face=Arial size=2>1 create a C++ object</FONT></DIV>
<DIV><FONT face=Arial size=2>2 convert it into a python object</FONT></DIV>
<DIV><FONT face=Arial size=2>3 pass it into python as a parameter to a
function</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Part 2 is the part that is holding me up.
Observe:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>class booga<BR>{<BR>public:<BR>
booga() : a( 0 ) {}<BR> int a;<BR> void
looga() { a = a + 10; cout << a << endl; }<BR>};<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>BOOST_PYTHON_MODULE( wrap )<BR>{<BR></FONT><FONT
face=Arial size=2> class_<booga>( "booga"
)<BR> .def( "looga", &booga::looga
);<BR>}<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>int main()<BR>{<BR></FONT><FONT face=Arial
size=2> Py_Initialize(); </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> PyImport_AppendInittab(
"wrap", initwrap );<BR></FONT><FONT face=Arial size=2></FONT></DIV>
<DIV><FONT face=Arial size=2> booga b;<BR>
object obj( &b );<BR></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>That last line of code always throws an exception
of type error_already_set, from within the function "<FONT
size=2>value_arg_to_python". </FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>My thoughts are that I am missing something about a
custom converter, or similar, but I've read through the converter docs and I'm
quite baffled; they don't explain much. Would the BOOST_PYTHON_MODULE create a
custom converter for classes in there, or must I specify one manually, or
what?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I apologize if this is too simple of a problem, in
advance =)</FONT></DIV></BODY></HTML>