comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Ada bindings to C++ class templates
Date: Sat, 5 Mar 2011 02:56:56 -0800 (PST)
Date: 2011-03-05T02:56:56-08:00	[thread overview]
Message-ID: <813fe5ee-5817-4a39-95b3-53dc4658df3a@t16g2000vbi.googlegroups.com> (raw)
In-Reply-To: 92802151-a15a-444f-9224-3710a144d83c@hd10g2000vbb.googlegroups.com

On 5 Mar, 10:36, David Sauvage <sauvage.da...@gmail.com> wrote:

> I'm trying to know more about how to write Ada bindings to C++ class
> templates.

There is no direct way to couple Ada with C++ at the level of class
templates, so...

> I would prefer to implement the necessary intermediate C layers to
> make the binding compiler portable if possible.

and this is the recommended way to go - create a layer of thin C
interfaces to whatever C++ stuff you want to use and bind to that
interface. This seems to be time consuming, but in fact is not - the
actual application code on both sides tends to be much bigger and this
allows to quickly amortize the additional effort to create the C
interface layer.

The problem is that the C interface layer will not be generic and will
force you to "flatten" the type space to what is available in C. On
one hand this seems to be a severe limitation (it is from the design
point of view), but on the other hand (the deployment point of view)
it isolates the two sides well enough to allow complete replacement of
either component, and it also open some new opportunities, like using
the low-level component in interpreters (Python, Tcl, etc.).
So, in short - yes, creating a C layer is a preferred way to go and
even though requires some up-front effort, it brings long-term
benefits.

--
Maciej Sobczak * www.msobczak.com * www.inspirel.com



  reply	other threads:[~2011-03-05 10:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-05  9:36 Ada bindings to C++ class templates David Sauvage
2011-03-05 10:56 ` Maciej Sobczak [this message]
2011-03-07  4:43   ` David Sauvage
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox