From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5b2dc2b8126f7044 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!t16g2000vbi.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Ada bindings to C++ class templates Date: Sat, 5 Mar 2011 02:56:56 -0800 (PST) Organization: http://groups.google.com Message-ID: <813fe5ee-5817-4a39-95b3-53dc4658df3a@t16g2000vbi.googlegroups.com> References: <92802151-a15a-444f-9224-3710a144d83c@hd10g2000vbb.googlegroups.com> NNTP-Posting-Host: 62.244.151.176 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1299322616 13432 127.0.0.1 (5 Mar 2011 10:56:56 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 5 Mar 2011 10:56:56 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: t16g2000vbi.googlegroups.com; posting-host=62.244.151.176; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:18857 Date: 2011-03-05T02:56:56-08:00 List-Id: On 5 Mar, 10:36, David Sauvage 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