From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4e5840c8658b8b86 X-Google-Attributes: gid103376,public From: dvdeug@x8b4e53cd.dhcp.okstate.edu (David Starner) Subject: Re: Passing Strings between Ada and C++ Date: 2000/01/12 Message-ID: <85iq0u$7pu3@news.cis.okstate.edu>#1/1 X-Deja-AN: 571828187 References: <387CDCEC.461BAB3F@cpmx.saic.com> Organization: Oklahoma State University User-Agent: slrn/0.9.6.2 (Linux) Reply-To: dstarner98@aasaa.ofe.org Newsgroups: comp.lang.ada Date: 2000-01-12T00:00:00+00:00 List-Id: On Wed, 12 Jan 2000 14:58:36 -0500, Caroline wrote: >I am experimenting with interlanguage programming and have the following >question: > >What is the best way to pass a string from C++ to an Ada procedure and >to pass one out of Ada back to C++? I would like to know in particular >what incarnations of strings to use on each side. > >I am using Aonix ObjectAda 7.1.2 and MS Visual Studio 6.0. If you use C null-terminated char arrays, you can translate between C strings and Ada strings using Interfaces.C. See your local header file or the ARM for more information. GNAT would let you interface directly with the C++ string class using Interfaces.CPP. I don't think ObjectAda has a similar facility, but it can't hurt to look. -- David Starner - dstarner98@aasaa.ofe.org If you wish to strive for peace of soul then believe; if you wish to be a devotee of truth, then inquire. -- Friedrich Nietzsche