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

pawell pablo_best at o2.pl
Tue Mar 11 01:34:09 CET 2008

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" ).

Stefan Seefeld wrote:
> pawell wrote:
>> I would like to use Python in my game engine as a script language but
>> first I
>> want to test Python as console (something like interactive mode). I
>> tested
>> boost.python and encountered problem. I want to expose global variables
>> so I
>> can use them in some module (__main__ for example). I found I can use
>> something like "scope().attr("var_name") = object(ptr(var_ptr))" but it
>> works only with classes (like std::string or my own). Is there simple way
>> to
>> expose such variables? I've searched a lot but found nothing :/
> I'm not sure what exactly you are referring to as "it works...". What 
> variables (or better, what types) do you want to expose that don't "work"
> ?
> Regards,
> 		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

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

More information about the Cplusplus-sig mailing list