Article View: comp.std.c
Article #3777ADA/C++ Compatibility problems
From: David Sivia
Date: Fri, 18 Aug 1995 15:31
Date: Fri, 18 Aug 1995 15:31
50 lines
2995 bytes
2995 bytes
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 ***********************************************************************
Technical Details
Message-ID:
<412bog$7rn@hatch.sonalysts.com>Path:
arc1-ca.pugleaf.net!hatch.sonalysts.com!dasilviaShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!hatch.sonalysts.com!dasilvia From: dasilvia@sonalysts.com (David Sivia) Newsgroups: comp.std.c Subject: ADA/C++ Compatibility problems Date: 18 Aug 1995 15:31:28 GMT Organization: Sonalysts, Inc. Message-ID: <412bog$7rn@hatch.sonalysts.com> NNTP-Posting-Host: hatch.sonalysts.com X-Newsreader: TIN [version 1.2 PL2]