Rolf said:
Evan Carew wrote:
[snip]
Actually, there are C++ wrappers for the GNOME libs (e.g. gtkmm) and
some gnome programs are actually written in C++. There are also quite
some Un*x libs that are written in C++ and used from C programs, or
even plugin systems where the plugins and the main program are not
written in the same language, so glueing C code and C++ code together
isn't actually that uncommon.
I've seen the fine job the gtkmm folks did with the C++ wrapper, I've
also been stepping through the underlying gtk code as of late & that is
exactly why I am here talking about this technique. In other words, it
sure would be nice to be able to refactor this code in an OO environment.
As for gluing C to C++, yes, it is done, but what I have been seeing up
to now has involved use of knowledge in how C++ mangles its names & then
tying that into the C environment. Not what I would call generic
programming (or version stable for that matter).
I've also been informed recently that there are some projects as you
describe which utilize this technique, however, for some reason its use
hasn't been documented in any texts, or manuals I have seen. Even the
article in C/C++ Users Journal I saw didn't discuss the issues related
to getting your compiler to actually link all the code together. Perhaps
this subject could stand some dissemination.
Some developers want to use C rather than C++.
Yep, especially if they are embedded programmers like myself. There is a
place for C++ and typically, embedded programming isn't it. On the other
hand, GUI programming is perfect for C++ & I can't understand why some
projects persist in having their core development done in C (like
GNOME). KDE for example is done (mostly) in standard C++ & is rather
pleasant to program in. Gnome on the other hand is done entirely in C as
are most of its core components & working with those is ... well... lets
just say that it could be better. While the C++ wrapper libraries for
GNOME are fine, it is a little like kissing through saran wrap. If you
need to change anything, you still need to drop into C.