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

Re: C++ Binding Project?





--- alan@pcmagic.net wrote:
> 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


The Crystal Space people wrote the thing based off of a open source port of Microsoft COM.  It
will allow bindings for other langauges.  Also Netscape's Mozilla has cross platform COm
implementation that you could use

crystal.linuxgames.com
mozilla.org

Swig is more limited then COM, I think, but go ahead and check it out to
http://www.swig.org/
===



Cubesoft development
http://www.linuxsupportline.com/~cubesoft

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com