Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-02-08 16:29:48


This is my fault; I changed the interface without updating the docs. In
fact, you don't need handle_exception anymore (it gets put in for you
automatically). The example in libs/python/getting_started1.cpp has the
correct code:
-------

// Example by Ralf W. Grosse-Kunstleve

#include <string>

namespace { // Avoid cluttering the global namespace.

  // A couple of simple C++ functions that we want to expose to Python.
  std::string greet() { return "hello, world"; }
  int square(int number) { return number * number; }
}

#include <boost/python/class_builder.hpp>
namespace python = boost::python;

// Python requires an exported function called init<module-name> in every
// extension module. This is where we build the module contents.
BOOST_PYTHON_MODULE_INIT(getting_started1)
{
    // Create an object representing this extension module.
    python::module_builder this_module("getting_started1");

    // Add regular functions to the module.
    this_module.def(greet, "greet");
    this_module.def(square, "square");
}

----- Original Message -----
From: "Aaron Brashears" <gila_at_[hidden]>

> I'm testing out integrating our project with python using the boost
> libraries. I wrote a small wrapper application around our libraries
> and then tried to compile it. This failed. I then went back and tried
> to build the sample provided in the documentation, but got the same
> error. The error is:
>
> $ cd ~/python/
> $ make -k
> g++ -g -Wall -I../boost_1_27_0 -I/usr/include/python -c test.cpp
> test.cpp: In function `void init_module_getting_started1()':
> test.cpp:27: no matching function for call to `handle_exception ()'
> make: *** [test.o] Error 1
> make: Target `test' not remade because of errors.
>
>
> I checked in the errors.hpp file in the python library, and it looked
> ok. This is a direct copy of the sample provided in the documentation
> - what am I doing wrong?
>
>
> For reference, I'm using gcc 2.95.2 and python 1.5.2 on linux.
>
>
>
>
> Info: http://www.boost.org Send unsubscribe requests to:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk