comp.lang.ada
 help / color / mirror / Atom feed
* Ada bindings to C++ class templates
@ 2011-03-05  9:36 David Sauvage
  2011-03-05 10:56 ` Maciej Sobczak
  0 siblings, 1 reply; 3+ messages in thread
From: David Sauvage @ 2011-03-05  9:36 UTC (permalink / raw)


Hi,

I'm trying to know more about how to write Ada bindings to C++ class
templates.
Unfortunately, I have found no documentation concerning this subject.
May be we could use the C++ STL vector class template [1] as a basis
for the discussion & hints (if any).

I would think that the Ada binding would start from a generic package.

I would prefer to implement the necessary intermediate C layers to
make the binding compiler portable if possible. (instead of using g++ -
fdump-ada-spec for example)

Any help & hints would be appreciate.


[1] http://en.wikipedia.org/wiki/Vector_(C++)

--
David



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Ada bindings to C++ class templates
  2011-03-05  9:36 Ada bindings to C++ class templates David Sauvage
@ 2011-03-05 10:56 ` Maciej Sobczak
  2011-03-07  4:43   ` David Sauvage
  0 siblings, 1 reply; 3+ messages in thread
From: Maciej Sobczak @ 2011-03-05 10:56 UTC (permalink / raw)


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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Ada bindings to C++ class templates
  2011-03-05 10:56 ` Maciej Sobczak
@ 2011-03-07  4:43   ` David Sauvage
  0 siblings, 0 replies; 3+ messages in thread
From: David Sauvage @ 2011-03-07  4:43 UTC (permalink / raw)



Thanks for the hints, I will try and let you know.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-07  4:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-05  9:36 Ada bindings to C++ class templates David Sauvage
2011-03-05 10:56 ` Maciej Sobczak
2011-03-07  4:43   ` David Sauvage

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