Richard W.M. Jones wrote:
> On Tue, Apr 16, 2013 at 03:12:38PM +0200, Miloslav Trmač wrote:
> > On Mon, Apr 15, 2013 at 11:19 PM, Richard W.M. Jones 
> > <rjo...@redhat.com>wrote:
> > 
> > > On Mon, Apr 15, 2013 at 06:48:32PM +0200, Miloslav Trmač wrote:
> > > > Now, what to move to?  I currently don't have see any language/runtime I
> > > > could recommend, which is in itself rather frightening.
> > >
> > > Ada, Eiffel, Go, Coq + OCaml, Erlang, Haskell, CompCert[*], etc. etc.
> > >
> > > All these languages are viable.
> > 
> > Perhaps for end-user applications[1], but not for libraries/code
> > reuse/implementing platform interfaces to be usable by applications.  How
> > do I call an Eiffel library from Ada and pass it a callback written in Go?
> 
> The answer (perhaps sadly) is you have to expose a C API.  At least
> OCaml and golang can generate C-compatible shared libraries.  Probably
> Eiffel and Ada too, although I'm not certain on the details.

The Ada standard specifies features for interfacing to C, COBOL and
Fortran, both importing and exporting interfaces. GNAT adds support for
C++, claiming complete interoperability between Ada tagged types and
C++ classes. I'm sure support for other compiled languages could be
added if there were a demand, especially if GCC can compile those
languages.

> Passing pointers to objects from one language to another is likely
> *not* possible however.

Ada imports and exports C pointers just fine, including pointers to
functions and records. Strings typically need to be converted though,
as strings aren't null-terminated in Ada.

Of course Ada can't prevent the C code from corrupting the pointers.

Björn Persson

Attachment: signature.asc
Description: PGP signature

-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel

Reply via email to