[C++-sig] undefined symbols with def_readonly
Andreas Klöckner
lists at informa.tiker.net
Fri Apr 11 16:26:51 CEST 2008
On Freitag 11 April 2008, Stefan Seefeld wrote:
> > 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.
Yeah, that was kinda the whole point--you introduce a small static getter
function to return the value of the static data member.
That getter does not need to take the address of the member, and therefore you
don't need to have memory allocated for it. Having the extra
function "litter" around is not pretty, but it was acceptable to me. The
address of the *getter* is what you pass to add_static_property(). Sorry for
not being sufficiently clear.
Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20080411/67c9d53d/attachment.pgp>
More information about the Cplusplus-sig
mailing list