[9276] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] Re: Why is gtk+ written in C?

daemon@ATHENA.MIT.EDU (Andreas Kostyrka)
Wed Oct 14 05:48:52 1998

Date: Wed, 14 Oct 1998 13:50:51 +0200 (CEST)
From: Andreas Kostyrka <andreas@rainbow.studorg.tuwien.ac.at>
To: gtk-list@redhat.com
In-Reply-To: <19981013181407.21220.rocketmail@send1d.yahoomail.com>
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com



On Tue, 13 Oct 1998, Eric Harlow wrote:

> 
> Isn't C++ portable? 
> Couldn't GTK have been written C++ with bindings to other languages? 
The problem is that not all other languages are written in C++.
(Or offer C++ access features.)
So in the best case it would be:
write C wrapper functions for the C++ stuff.
write language X wrapper for the C stuff.

Examples, I know personally, are TOM (which allows to embed C code
directly, but NOT C++), ...

Leaving thin mundane stuff, there are some other problems:
-) Consider a library xyz that contains in fact the interpreter for
   language xyz. It's written in C and compiled with the C compiler.
-) Consider now a C++ library that uses callbacks (GUI stuff usually
   does):
   C++            (C++ compiled)       main function
   C              (C compiled)         interpreter main loop
   C++            (C++ compiled)       GUI toolkit event loop.
   C              (C compiled)         callback (into the xyz language)
   C++            (C++ compiled)       some manipulator function.

   Now NOTHING in in the ANSI C standard defines that C++ exception are
   propageted across C code. So forget about exception.

-) Additionally, you have to consider that almost all newer languages
   come with some kind of GC. Again it's probably easier to interface with
   C as with C++ which already comes with some idea of
   constructors/destructors.

Andreas

-- 
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post