ADA/C++ Compatibility problems

dasilvia@sonalysts.com (David Sivia)
Fri, 18 Aug 1995 15:21:45 GMT

          From comp.compilers

Related articles
ADA/C++ Compatibility problems dasilvia@sonalysts.com (1995-08-18)
Re: ADA/C++ Compatibility problems papayd@gtewd.mtv.gtegsc.com (Dave Papay M/S 7G32 x2791) (1995-08-21)
Re: ADA/C++ Compatibility problems bobduff@world.std.com (1995-08-21)
Re: ADA/C++ Compatibility problems stachour@klondike.winternet.com (1995-08-25)
Re: ADA/C++ Compatibility problems jan@neuroinformatik.ruhr-uni-bochum.de (1995-08-30)
Re: ADA/C++ Compatibility problems gbaker@rp.CSIRO.AU (1995-09-07)
Re: ADA/C++ Compatibility problems jan@neuroinformatik.ruhr-uni-bochum.de (1995-09-07)
[4 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: dasilvia@sonalysts.com (David Sivia)
Keywords: Ada, C++, question, comment
Organization: Sonalysts, Inc.
Date: Fri, 18 Aug 1995 15:21:45 GMT

Ladies and gentlemen,


      I work at the Naval Undersea Warfare Center in Newport, RI.. We are
currently working on a project, called PHOENIX, which is programmed in
X and C++ using an Object-Oriented paradigm.. Unfortunately, because we
are in the Defense industry, we must still be able to communicate with
legacy systems using ADA and C.. Therefore, we must give this legacy code
some type of interface to communicate with our newer systems using C++..
We've been successful mixing C and C++; however, we've had some problems
trying to mix ADA and C++, the problem is as follows:


      A test program was written to test the ability to have an ADA main
calling a C function which is an interface to a C++ method. The test took
place on an HP 9000s700 series workstation, running the HP-UX verion 9.0.1
UNIX operating system. The HP was using the following compilers: (1) HP
C++ compiler version 3.05, (2) HP C compiler version 9.34 and (3) Verdix
ADA (VADS) version 6.2.1k.


      A simple C++ class was created which contained a single variable and
constructor to initialize it. A C++ function then instantiated an object
of that class type, hence initializing it via the constructor. The C++
function returned the value of the single variable. This function was com-
piled and archived in a separate library. An ADA function was then written
which called the C function via a PRAGMA command and also returned a the
variable. This was compiled and stored in the ada.lib ada library. Finally,
an ADA main was created which called the ADA function. The ADA main was
then compiled and linked.


      The ADA main executed properly as long as the C++ function and class
didn't contain certain C++ functions (i.e., streaming operators like cout
or cin). Whenever we tried using the streaming operators a run-time exep-
tion occurred. We tried explicitly calling the _main() C++ initialization
function in the ADA main, but also caused a run-time exeption.
      We are currently searching for ways to resolve this ADA to C++ compa-
tibility problem, because the driving forces at this lab mandate full
support for older ADA legacy code. We would appreciate any ideas or resol-
utions anyone may have to resolve this situation. Thanks..


al


--
***********************************************************************
Alberto Tavares E-mail: tavares@iris-15.npt.nuwc.navy.mil
Naval Undersea Warfare Center
Code 2212 Bldg 1171-1 Phone : (401) 841 4114
Newport RI 02841 Fax : (401) 841 4749
United States
[I fear you'll have to develop separate band-aids for each platform on which
you plan to run this code. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.