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

Re: C++ Binding Project?



alan@pcmagic.net wrote:

> I haven't thought it through completely and it may be ugly but some
> thing like this would let library authors choose C++ (if they like it in
> the first place) without cutting out a part of their audience that may
> prefer a not to directly use C++.  Alternately, there might be some way
> to do a binary analysis of the library file to generate headers for the
> bindings, but then we might be getting into a CORBA-like area...

It would be nice if it was possible just to create aliases symbols in
object files (symbols pointing to the same area). Then, you could create
a tool that would make a C header where the first parameter would always
be a "this", thus emulating the C++ stuff by hand.

It would avoid a wrapper call, because calling the alias would be just
like calling the real thing. Of course, virtual methods wouldn't work.
:-)

Maybe it is even simpler. Look at db.h for enlightenment on C-based
vtables (yes it is ugly, but you want the feature or not?).

-- 
Pierre Phaneuf
Ludus Design, http://ludusdesign.com/
"First they ignore you. Then they laugh at you.
Then they fight you. Then you win." -- Gandhi