Boost logo

Boost :

From: jfo60540_at_[hidden]
Date: 2001-07-26 14:43:14


--- In boost_at_y..., rwgk_at_m... wrote:
> --- In boost_at_y..., jfo60540_at_y... wrote:
> > Hi -
> >
> > I am new to boost.python. I compiled the library with Python 2.1.1
> and
> > gcc
> > 3.0 under Solaris 2.7. There were a few minor problems (gcc stl
> > headers
> > are broken and std::sin(float) and std::cos(float) are left
> undefined
> > ),
> > but I eventually got all the tests (in particular
comprehensive.py)
> > to
> > work properly.
>
> Do you have a Makefile and/or patches? It would be good if we could
> add your changes to the CVS tree.
> Ralf

Well, what would be needed is a patch for the g++ headers ... or
possibly to the sun libm. I took a quick look at the headers and I
concluded that it is a mess that I do not want to get into. The
problem originates from the fact that in std c++, overloaded versions
of the trig functions such as sin, cos
must be explicitly defined. This is done in the headers using multiple
levels of macros. The end result is that float std::cos(float) calls
cosf(float) , which should be defined in libm, I suppose. Under
Solaris, cosf is left undefined. The quick fix is to define these
functions in an external source file, as follows

float cosf(float x) {
  return static_cast<double>(std::cos(static_cast<double>(x)));
}

float sinf(float x) {
  return static_cast<double>(std::sin(static_cast<double>(x)));
}

   
etc ...


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