Re: gtkmm3 and global objects



On Thu, 2011-09-01 at 12:26 -0600, D. R. Evans wrote:
> I'm just getting started with gtkmm3. I looked in the documentation, but
> couldn't see how to resolve this simple issue:
> 
> The tutorial at
> 
> http://developer.gnome.org/gtkmm-tutorial/unstable/sec-basics-simple-example.html.en
> implies that the very first gtkmm call is supposed to be to Gtk::Main(argc,
> argv).
> 
> How does arrange for this to happen if one is creating global gtk objects
> (i.e., objects created before main(argc, argv) is entered)?
> 
> (One could obviously cheat and have only pointers instead of fully-fledged
> objects declared globally, but I'd rather understand the real solution and
> use proper global objects rather than add a layer of indirection that
> wasn't necessary before I started porting the program to gtkmm.)

It's generally best to avoid global static instances anyway. It's very
hard to make sure that they are initialized in any predictable sequence.

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]