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

C++ Binding Project?



I've been lurking on this list for a while, but I have a question
triggered by the recent discussion/flame war about C++ as a language. 
In particular, there was an objection raised to using C++ in code
libraries because of difficulty in creating language bindings to code
outside C++.  IMO its a valid point.  Does anyone know of a open source
project that aids C++ binding to other languages.  

It seems to me that work to automatically generate procedural bindings
to C++ would remove a valid objection to using C++ as a library
language.  One of the simpler ideas I'm kicking around is a C++ header
parsing engine the might convert something like:

class Widget {

public:
Widget();
~Widget();
void GetID();

private:
int id;
}

to "procedural" bindings (for example C) like:

Widget_handle* Widget_new();
int Widget_GetID();
Widget_destructor(Widget_handle*);


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...

Do I need to start my own project?
Alan

-- 
Alan Chen
Aerospace Simulation Engineer and Recovering Linux Newbie
Now Running: Redhat 6.0 + Tweaks