← Back to team overview

coapp-developers team mailing list archive

Re: Code?

 

On Mon, May 17, 2010 at 5:38 PM, Elizabeth M Smith <
emsmith@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

> On 5/17/2010 7:36 PM, Olaf van der Spek wrote:
>
>> On Tue, May 18, 2010 at 1:23 AM, Elizabeth M Smith
>> <emsmith@xxxxxxxxxxxxxxxxxxxxxxx>  wrote:
>>
>>
>>> As we discussed during the summit and is mentioned on the wiki:
>>>
>>>
>> Ah, found it.
>>
>>
>>
>>> Few dependencies
>>> Fast
>>> Small
>>> Binding facilities for most high level languages are common
>>>
>>> The ability to tie a C library into anything and everything is the
>>> biggest
>>> reason to use C over C++, using and binding to C++ libraries (especially
>>> in
>>> most languages - they tend to be written in C) is a real headache -
>>> actually
>>> beyond a headache, most times it's just a recipe for failure.
>>>
>>>
>> C++ can do C bindings as well, can't it? Our bindings should certainly be
>> C.
>> Doesn't C++ share the other advantages?
>>
>> Olaf
>>
>>
> What?  I mean binding coapp to other higher level languages primarily
> written in C.  Perl, Python, PHP, Lua, D etc.
>
> and if we write it in C - yes a C++ binding would be easy as well.
>
> Thanks,
> Elizabeth Smith
>
>
In case Olaf means writing the library in C++ itself instead of C, only
functions defined outside of a class can
be defined with a C binding.  As soon as it's in a class it must use C++
bindings and all the name
mangling takes effect.  Once that happens, connecting to the classes from
the other languages is
almost impossible.

I've seen people try to to create bindings to a C++ library and it usually
involves writing a middle C layer between the
other apps and the C++ library.  No point in doing that if we can just write
it in C in the first place.

-- 

Trevor Dennis

Follow ups

References