[C++-sig] undefined symbols with def_readonly
Stefan Seefeld
seefeld at sympatico.ca
Fri Apr 11 13:40:41 CEST 2008
Neal,
you haven't commented on whether my (last two) suggestions worked. Did
they ?
Neal Becker wrote:
>> pic_wrap
>> .add_static_property("dimensions_pos", &cl::get_dimensions_pos)
>>
>> Andreas
>
> Didn't work here.
> .add_static_property ("TAIL_BITS", &turbo_enc_1_15::TAIL_BITS)
>
> Still gives
> ImportError: ../mod/turbo_enc_1_15.so: undefined symbol: _ZN14turbo_enc_1_159TAIL_BITSE
Yes of course. The problem is totally unrelated to boost.python, as I
tried to explain in my very first reply. It's because you never define
the static member, so no memory for it is allocated that you can
dereference (and no associated symbol is emitted). Using its value
itself works, as the compiler already knows that, so can fold it into
the expression wherever it occurs.
> But what's _really_ weird, is:
> .add_static_property ("TAIL_BITS", turbo_enc_1_15::TAIL_BITS)
>
> gives:
> TypeError: 'int' object is not callable
That suggests that, even though the add_static_property function
template is generic (read: unconstrained) in its second parameter
(leading to the construction of a python 'int' object holding
TAIL_BITS), such an object is not callable (as static properties should
be). In other words, users are expected to pass function (pointers) or
similar there, and the implementation of add_static_property just fails
to enforce that.
Regards,
Stefan
--
...ich hab' noch einen Koffer in Berlin...
More information about the Cplusplus-sig
mailing list