[C++-sig] Global variables (standard C/C++ types)

pawell pablo_best at o2.pl
Tue Mar 11 01:53:27 CET 2008




Stefan Seefeld wrote:
> 
> pawell wrote:
>> Standard c/c++ types like int, double, bool, etc. When I try something
>> like:
>> "scope().attr("a") = object(ptr(&some_bool_var));" I get from gcc:
>> "/usr/include/boost/python/object/make_instance.hpp:24: error: invalid
>> application of ‘sizeof’ to incomplete type"
>> I would like to use "a" variable like a standard Python's boolean type (
>> "a
>> = True" ).
> 
> int, float, bool and similar types are immutable in python. You can set
> 
> scope().attr("a") = some_bool_var;
> 
> (copying the value of some_bool_var into a global python variable 'a'). 
> But there is no way to store a reference to a boolean variable living in 
> C++.
> 
> HTH,
> 		Stefan
> 
> -- 
> 
>        ...ich hab' noch einen Koffer in Berlin...
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
> 
> 

I will probably write some class - with set/get methodes - that holds
reference to those variables or try to get values from Python.

thanks for help :)
-- 
View this message in context: http://www.nabble.com/Global-variables-%28standard-C-C%2B%2B-types%29-tp15968033p15972138.html
Sent from the Python - c++-sig mailing list archive at Nabble.com.




More information about the Cplusplus-sig mailing list