TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show HTML Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Ed Falis <[log in to unmask]>
Reply To:
Fri, 23 Jan 1998 09:53:49 -0500
text/plain (63 lines)
-----Original Message-----
From: Laurent Guerby <[log in to unmask]>
>   It is important to understand that it is not a language issue (*),
>   but a specific compiler/system issue. On NT, and for C++ in
>   general, there is no standard object format. Most of the time, you
>   cannot mix objects produced from 2 different C++ compilers, and
>   even if you could, it is unlikely to work because the 2 C++
>   runtimes probably won't work together. The situation is the same
>   between 2 Ada compilers (*).

I beg to disagree: the codeview format as used by MSVC++ is pretty much a de
facto standard for NT.  Furthermore there's always the DLL approach
available for language interoperability.

>   If you are in a multi-language project, it is in general better to
>   avoid mixing languages in the same executable.

Provided the Ada compiler has adainit and adafinal available for elaboration
prior to calls into Ada from C/C++ this is not a major problem, though I
generally recommend the DLL approach.

>   It is far better (much less risk, less headaches) to separate the 2
>   parts, and to use either a C-level interface, and/or some system
>   interprocess communication (pipes, shared memory, messages,
>   etc...).
>   This generally has also a good impact on the application design,
>   since it enforces subsystem boundaries. (Eg: avoiding to have GUI
>   code spreaded all over the place in your code.)


>   So to answer your question: at the language level (Ada 95 and C++)
>   there's nothing that guarantee that it will work, experience
>   indicates that it won't work.

The "won't work" tends to be mainly in the area of inheritance across the
language boundary.  Most other issues are pretty workable.

>   Unless of course you can find a particular Ada 95 compiler that was
>   designed with cohabitating with a particular C++ runtime.
>(*) Note that Ada 95, with Import, Export and Convention pragmas plus
>    the adainit/adafinal implementation advice makes it easier to
>    integrate other languages. I worked on a project where some of the
>    code was compiled with the Sun C++ compiler and the rest with
>    GNAT, we defined a C-level interface between the two parts, and
>    linked with the C++ compiler linker calling adainit/adafinal from
>    the C++ main and things worked fine (Motif, Ada tasking and C
>    threading were there too, and it wasn't an academic example).

We have many customers using the two languages together on Win 95 and NT.
So, our experience differs.

- Ed Falis