comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Creem <jeff@thecreems.com>
Subject: Re: Calling C++ from Ada
Date: Sun, 14 May 2006 09:39:22 -0400
Date: 2006-05-14T09:39:22-04:00	[thread overview]
Message-ID: <pgojj3-iee.ln1@newserver.thecreems.com> (raw)
In-Reply-To: <pan.2006.05.14.08.59.44.155698@laposte.net>

Yves Bailly wrote:
> On Sat, 13 May 2006 15:55:38 -0400, Jeffrey Creem wrote:
> 
>>If you are thinking of doing something yourself perhaps you should look 
>>at adding an Ada output module for SWIG.
>>Looking at some of the other language output modules it appears that it 
>>is a reasonably small project.
> 
> 
> Interesting. I'll dig into this, it seems promising.
> 
> Sorry if I'm boring everyone here, but I would like to submit some
> thoughts on a way to call C++ from Ada, through a C wrapper, avoiding
> too much dynamic memory allocations.


I would not worry about boring anyone. This has been an area where there 
has always been interest since the early days of comp.lang.ada.

I think most here are interested in the topic.

> 
> The basic idea is to reserve the needed space on the Ada side, then to
> use the placement "new" on the C++ side. 
> 

The biggest problem I see with th is is ithat it is not clear that this 
really is portable. The problem is that the code is making assumptions 
about the layout of the std::string class and assumptions about what the 
compiler will do with respect to dope vectors. While nesting the string 
in the record probably makes it so that the compiler does not need to 
generate a dope vector, I am not sure if it requires that the compiler 
not do so. I suspect there are also other issues with respect to the 
class, tags, and other layout issues that are not guaranteed to be portable.

Having said that, it is worth pointing out that more "useful" 
implementations have been sacrificed on the alter of future portability 
in this newsgroup than I'd like to count. I hate to think of the number 
of approaches that were rejected due to portability and then replaced 
with something equally non-portable from a different language.





  reply	other threads:[~2006-05-14 13:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-13 14:48 Calling C++ from Ada Yves Bailly
2006-05-13 17:02 ` Jeffrey Creem
2006-05-13 19:08   ` Yves Bailly
2006-05-13 19:55     ` Jeffrey Creem
2006-05-14  8:59       ` Yves Bailly
2006-05-14 13:39         ` Jeffrey Creem [this message]
2006-05-14 18:38         ` Jeffrey R. Carter
2006-05-15 15:24       ` rodkay
2006-05-15 16:23         ` Jeffrey Creem
2006-05-16  2:14         ` Gene
2006-05-16  4:31           ` rodkay
2006-05-16 11:47             ` Jeffrey Creem
2006-05-17  4:53               ` rodkay
2006-05-17  6:05                 ` Martin Krischik
2006-05-25  5:34                   ` rodkay
2006-05-25 11:29                     ` Alex R. Mosteo
2006-05-29  3:43                       ` Gene
2006-05-29 14:53                         ` rodkay
2006-05-29 17:48                         ` Martin Krischik
2006-05-13 22:38     ` Craig Carey
replies disabled

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