Re: GTK+ & C++
- From: Havoc Pennington <hp redhat com>
- To: John Schmerge <schmerge cyber com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: GTK+ & C++
- Date: 08 Jan 2001 14:34:50 -0500
John Schmerge <schmerge cyber com> writes:
I have a couple of very nasty questions for people out there...
1. Does anybody out there know if it is possible to compile glib & gtk+ using a
c++ compiler?
No, you'd have to fix a bunch of implicit void* casts, C++ keyword
uses, and that kind of thing.
2. If the above cannot be done, does anybody have any experience w/ integrating
c++ code that uses the language's exception handling capabilities w/ gtk+ -- I
am starting to run into nasty problems of having a program core dump whenever an
exception is thrown from a c++ code fragment that is called from the gtk
mainloop...
You can't throw C++ exceptions through C code. You need to catch those
exceptions before they get back to GTK+.
Compiling GTK with a C++ compiler doesn't help; throwing an exception
through GTK functions would get GTK's internal data structures
mangled, leaking memory and causing segfaults. This will be true for
any C library. Using exceptions pretty much depends on using
destructors to clean up when an exception comes through.
So basically if you do exception-causing stuff from a signal handler,
you have to catch any exceptions in the handler itself, you can't
throw them through GTK.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]