[C++-sig] Re: problem using global variable, static variable

Nicodemus nicodemus at globalite.com.br
Sat May 24 01:07:17 CEST 2003


David Abrahams wrote:

>Cyril Bonnard <cyril.bonnard at cirad.fr> writes:
>
>  
>
>>pyste generates code which seems very strange to me:
>>BOOST_PYTHON_MODULE(test)
>>{
>>    class_< color >("color", init<  >())
>>        .def(init< const color & >())
>>        .def_readwrite("col", &color::col)
>>    ;
>>
>>    def("_GLOBAL__D__home_cbonnard_devlp_AMAPmod_src_GEOM_test.hef3xme",
>>    &_GLOBAL__D__home_cbonnard_devlp_AMAPmod_src_GEOM_test.hef3xme);
>>    def("_GLOBAL__I__home_cbonnard_devlp_AMAPmod_src_GEOM_test.hp8ylhc",
>>    &_GLOBAL__I__home_cbonnard_devlp_AMAPmod_src_GEOM_test.hp8ylhc);
>>    
>>
>
>This appears to be a Pyste bug.  It should say:
>
>     scope().attr("BLACK") = BLACK;
>  
>

(Sorry for not responding earlier: my internet connection wasn't working.)

The bug in this case is trying to export those two functions, which are 
clearly for internal use of the compiler(_GLOBAL___D__home_... is a 
function). I will change AllFromHeader so that it will ignore names that 
start with "_" (the same semantics of Python's "from foo import *" ;-) )

But Pyste now doesn't support global variables. I will add it, with a 
"Var" declaration, similar to a "Class" declaration.

Thanks Cyril,
Nicodemus.







More information about the Cplusplus-sig mailing list