comp.lang.ada
 help / color / mirror / Atom feed
From: Luke A. Guest <laguest@archeia.com>
Subject: Re: Ada and C++ in the same binary, was: Re: Current status of Ada development for an Android target ?
Date: Sat, 18 Jun 2016 19:21:51 +0100
Date: 2016-06-18T19:21:51+01:00	[thread overview]
Message-ID: <1277310445.487966038.242735.laguest-archeia.com@nntp.aioe.org> (raw)
In-Reply-To: nk3q93$n06$1@dont-email.me

Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:

> Thanks Luke, but please don't go to any special effort on my behalf.

I had a go with google's compiler source on armv7-a, doesn't build. I have
an inkling that they've broken the Ada build machinery stuff on purpose.

> Having thought about the situation, I'm getting nervous once again about
> the "special" :-( situation around Ada compilers given that I'm not
> sure where some of this code might be used in the future.

It is a pain.

> 
> My current thinking (as of this morning :-)) is to maybe write the low
> level stuff in C++ (which is the code more likely to be used elsewhere)
> and to do the high level stuff in Ada.

You'll still require a compiler that can build it.

> The problem is that I don't have any experience combining C++ and Ada
> code in the same binary; in the past, I've only ever called plain C code
> from Ada.

Depends how you do it. It's tricky. You could use g++ as a generator but
you need to massage it by hand to get it to work. You could wrap the
classes by hand and flatten the API out to a bunch of C functions.

You could then wrap that API in Ada tagged types, which has its own issues
of you need to get an Ada tagged type back from the C++ side. As an
example, when I was attempting to wrap wxWidgets you can create a wxFrame
with a menu and status bar without needing to define Ada types for them. So
when you want to grab a status bar from the frame, you have to wrap the C++
pointer to the class you get back from the call in C with an Ada tagged
type that knows not to delete it on finalisation. The handling of these
things is the main issue with using proxy types.

Using the generator will be easier and faster but less portable to any
other future compilers, if any.


> Does anyone know of any issues combining C++ and Ada code in the same
> binary when using gcc and binutils ? Are there any conflicts with
> exceptions for example ?

The original non-working code for wxAda is on Tigris.

> The primary use of such binaries would be on a Linux x86 (and maybe
> ARM) platform.

  parent reply	other threads:[~2016-06-18 18:21 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-11 15:51 Current status of Ada development for an Android target ? Simon Clubley
2016-06-12  7:28 ` Luke A. Guest
2016-06-12  8:25 ` Luke A. Guest
2016-06-12  8:27 ` Luke A. Guest
2016-06-12 23:36   ` Simon Clubley
2016-06-13  4:24     ` Shark8
2016-06-13 13:49     ` Lucretia
2016-06-13 14:34       ` Lucretia
2016-06-14 13:22 ` jrmarino
2016-06-14 18:39   ` Simon Clubley
2016-06-15  9:41     ` jrmarino
2016-06-15 13:11       ` Simon Clubley
2016-06-15 12:12     ` Luke A. Guest
2016-06-15 13:02       ` Simon Clubley
2016-06-15 13:13         ` Lucretia
2016-06-16 19:20 ` Lucretia
2016-06-16 19:29   ` Simon Clubley
2016-06-16 19:49     ` Luke A. Guest
2016-06-18 15:44       ` Ada and C++ in the same binary, was: " Simon Clubley
2016-06-18 16:38         ` Simon Clubley
2016-06-18 18:21         ` Luke A. Guest [this message]
2016-06-19 14:50           ` Simon Clubley
2016-06-18 18:24         ` Shark8
2016-06-19 15:00           ` Simon Clubley
2016-06-19 15:32             ` Luke A. Guest
2016-06-19 17:52               ` Simon Clubley
2016-06-19 18:40                 ` Luke A. Guest
2016-06-19 19:16                   ` Simon Clubley
2016-06-19 20:32                     ` Luke A. Guest
2016-06-20 12:11             ` Jacob Sparre Andersen
2016-06-20 14:28               ` Luke A. Guest
replies disabled

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