comp.lang.ada
 help / color / mirror / Atom feed
* Passing Strings between Ada and C++
@ 2000-01-12  0:00 Caroline
  2000-01-12  0:00 ` David Starner
  2000-01-12  0:00 ` David Botton
  0 siblings, 2 replies; 3+ messages in thread
From: Caroline @ 2000-01-12  0:00 UTC (permalink / raw)


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.

Thanks
Caroline

--
Caroline Swindell

Remove "NOSPAM." to reply.






^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Passing Strings between Ada and C++
  2000-01-12  0:00 Passing Strings between Ada and C++ Caroline
  2000-01-12  0:00 ` David Starner
@ 2000-01-12  0:00 ` David Botton
  1 sibling, 0 replies; 3+ messages in thread
From: David Botton @ 2000-01-12  0:00 UTC (permalink / raw)


If you want to be able to create a String on the Ada side and then Free it
on the MS VC side or vice versa, use BSTRs.

See the AdaCOM.BSTR in the AdaWin packages on AdaPower for examples of using
BSTRs with Ada. http://www.adapower.com/lab/adawin.html

David Botton

Caroline <caroline.j.swindellNOSPAM@cpmx.saic.com> wrote in message
news:387CDCEC.461BAB3F@cpmx.saic.com...
> 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.
>
> Thanks
> Caroline
>
> --
> Caroline Swindell
>
> Remove "NOSPAM." to reply.
>
>








^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Passing Strings between Ada and C++
  2000-01-12  0:00 Passing Strings between Ada and C++ Caroline
@ 2000-01-12  0:00 ` David Starner
  2000-01-12  0:00 ` David Botton
  1 sibling, 0 replies; 3+ messages in thread
From: David Starner @ 2000-01-12  0:00 UTC (permalink / raw)


On Wed, 12 Jan 2000 14:58:36 -0500, Caroline <caroline.j.swindellNOSPAM@cpmx.saic.com> 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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-01-12  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-12  0:00 Passing Strings between Ada and C++ Caroline
2000-01-12  0:00 ` David Starner
2000-01-12  0:00 ` David Botton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox