[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gEDA: Yet more new code in CVS
On Mon, 27 Nov 2000, Ales Hvezda wrote:
> Anybody have any major technical reasons I cannot/should not link
> gtk+ (c libraries) with C++ code (assuming I properly extern "C" all
> the required parts)? I don't see anything wrong with doing that.
That's what I do with gpsim (http://www.dattalo.com/gnupic/gpsim.html). All of
the gui is in C and the simulator is in C++. The interface has unfortunately
evolved into a huge mess that really needs to be fixed. Calling C from C++ is
easy, but the other way around can be a pain. For example, how does C know how
to call a particular member function of an object? The way I handle it is with C
stubbed functions that take an "object id" (gets converted into a pointer to an
object) that wrap around the member functions. These C functions are extern'd as
C types, but are compiled as C++ code. They "know" about the classes and their
definitions and can call the member functions when needed. Furthermore, they can
be called from the C code. Yuk.
Scott