Re: [gtk-list] Re: I want to understand

Michael Babcock <> wrote,

> "Manuel M. T. Chakravarty" wrote:
> > 
> > Ionutz Borcoman <> wrote,
> > 
> > > Robert_Gasch/ wrote:
> > > >
> > > > 4) Using C++ as the base would make other language bindings more difficult
> > > > to write (??)
> > > C++ mangles names in the object code generated, while C not. I have
> > > understood that this is the reason why bindings to C code is simpler to
> > > made. Somebody please correct me if I'm wrong.
> > 
> > Basically, every language has a foreign language interface
> > to C, very few (does any?) have one to C++.  Moreover, for a
> > language binding it is not sufficient to just call some
> > external functions.  You have to convert data values from
> > the representation of one language to the other, you have to
> > get memory allocation and deallocation right, and so on.
> > All this is a pain when binding to C, but I wouldn't even
> > think about it for C++.
> That's why you write your interfaces in IDL and use CORBA standards.
> Writing your library in C is not the only way to make it language
> neutral. See, for example, Fresco.

True, in theory that is the way to go, but I am not sure
whether it would work out in practice.  I think, many IDL
compilers introduce quite some overhead in the calls; this
is no problem when the called functions do a lot of work,
but in a GUI like GTK+, it may be a problem.  More
problematic is that, although the IDL compiler takes care of
conversion of data types etc, it don't think it can reflect
gimmicks like overloading, inheritance, virtual classes etc.
So, either you leave this out, then the interface may seem
poorly designed from a C++ perspective, or you include it
and get problems writing the IDL.  But maybe, I just don't
know enough about IDL...


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