connecting library

View: New views
4 Messages — Rating Filter:   Alert me  

connecting library

by blackmet blackmet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, everyone.

Prompt me please, how can I connect extern library to bjam.
For example:
connect libd3d9.a from mingw package.

Thankful in advance.

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@...
http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: connecting library

by troy d. straszheim :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

blackmet blackmet wrote:
> Hi, everyone.
>
> Prompt me please, how can I connect extern library to bjam.
> For example:
> connect libd3d9.a from mingw package.
>

The wrong list I think, asking on you are.

-t






_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@...
http://mail.python.org/mailman/listinfo/cplusplus-sig

unfriendly python error message (no line number)

by Thomas Daniel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

No, it is not about template-related error messages :-)...

I am wrapping a class:
#include <boost/python.hpp>

struct X {
    X() : _x(0) {}
    int get() const { return _x; }
    int _x;
};

BOOST_PYTHON_MODULE(Test) {
    class_<X>("X")
        .def("get", &X::get)
    ;
}

and testing it with python:
x = X();
print x.get()
print x.get

Obviously, the error is that I forgot '()' in the second get(). I am
getting this error message:

0
<bound method X.get of <Test.X object at 0x2b0db13d4cb0>>

Is there a way to give user a more friendly error message in such case,
with at least a line number where it happened?

Note that if mistype the attribute name, I am getting something I much
nicer:

Traceback (most recent call last):
  File "test.py", line 5, in <module>
    print x.foo
AttributeError: 'X' object has no attribute 'foo'

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@...
http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: unfriendly python error message (no line number)

by Alex Mohr-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> No, it is not about template-related error messages :-)...
>
> I am wrapping a class:
> Obviously, the error is that I forgot '()' in the second get(). I
> am
> getting this error message:
>
> 0
> <bound method X.get of <Test.X object at 0x2b0db13d4cb0>>
>
> Is there a way to give user a more friendly error message in such
> case,
> with at least a line number where it happened?

This has nothing to do with boost.python.  It's how python works.  For example:

>>> class X(object):
        def __init__(self):
                self._x = 0
        def get(self):
                return self._x

       
>>> x = X()
>>> print x.get()
0
>>> print x.get
<bound method X.get of <__main__.X object at 0x02084FB0>>

And accessing 'x.get' is not in itself an error.  You may want to pass that bound method to a function expecting a callable, for instance.

Alex
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@...
http://mail.python.org/mailman/listinfo/cplusplus-sig