more complex boost::python examples/documentation?

Anthony Baxter anthony at interlink.com.au
Thu Feb 6 02:27:02 EST 2003


Does anyone have any examples using Boost::Python that are more complex
than the simple ones in the tutorial? I'm trying to wrap a large class
library (OpenH323) and I'm constantly banging my head against weird
errors that are more or less trial and error to figure out. The only 
chunks of code I can find are the bits in the "test" directory of the
distribution, and they're all a bit... artificial.

The specific case I'm trying to solve at the moment is that I have
a class (H323Connection) that defines a number of variants of a member
function MakeCall:

    H323Connection * MakeCall(
      const PString & remoteParty,  /// Remote party to call
      PString & token,              /// String to receive token for connection
      void * userData = NULL        /// user data to pass to CreateConnection
    );

    H323Connection * MakeCall(
      const PString & remoteParty,  /// Remote party to call
      H323Transport * transport,    /// Transport to use for call.
      PString & token,              /// String to receive token for connection
      void * userData = NULL        /// user data to pass to CreateConnection
    );

PString is the class library's own String class - I've already got 
functions working that accept them, and return them, fine (using converters).

It's really not clear to me how I'm supposed to specify which of these
methods I want to call. The BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS macro
seems to be more about the numbers of arguments, rather than choosing
from methods with different argument types.

BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(makecall_overloads, 
                                       H323EndPoint::MakeCall, 2, 3);
...
   class_<H323EndPoint>("H323EndPoint")
           .def("MakeCall", &H323EndPoint::MakeCall, 
                makecall_overloads(args("remoteParty", "token")))

produces 
h323.cpp:166: no matching function for call to 
   `boost::python::class_<H323EndPoint, boost::python::detail::not_specified, 
   boost::python::detail::not_specified, 
   boost::python::detail::not_specified>::def(const char[9], <unknown type>, 
   makecall_overloads)'

I've tried reading the reference documentation, to no avail. Is there another
source of information out there that I'm missing?

Thanks,
Anthony





More information about the Python-list mailing list