[C++-sig] exclude an entire class with pyste ?

Nicodemus nicodemus at globalite.com.br
Tue Apr 22 02:45:10 CEST 2003


Dominique Devriese wrote:

>nicodemus  writes:
>
>  nicodemus> Indeed, that is a "misfeature" of pyste, because it
>  nicodemus> shouldn't export forward declared classes at all. I
>  nicodemus> believe the desired behaviour would be to show a warning
>  nicodemus> in case the user tries to export an forward declared
>  nicodemus> class explicitly (using "Class"), or silently ignore them
>  nicodemus> when the AllFromHeader construct is used.
>
>I'm not sure if silently ignoring is a good option, since I can
>imagine that if someone has code like
>class SomeInternalClass;
>
>SomeInternalClass& getClass();
>
>doSomething( SomeInternalClass& );
>
>he'll want it to be exported..
>

Certainly, but not with this header, since it doesn't contain any useful 
info about SomeInternalClass. The user will have to export the class 
from SomeInternalClass.h, using Class or AllFromHeader constructs, as 
any other class.

But If you don't want to use the methods and attributes of 
SomeInternalClass, you just want to use functions that pass the class 
around, you should use return_opaque_pointer as a call policy. So your 
example would be exported as:

h = AllFromHeader('foo.h')
set_policy(h.getClass, return_value_policy(return_opaque_pointer))

and that's all. 8)

>  nicodemus> I will work on this. 
>
>great, thanks :)
>
You're welcome! Thanks again for the feedback.
Nicodemus.






More information about the Cplusplus-sig mailing list