comp.lang.ada
 help / color / mirror / Atom feed
* Re: Ada to C++ communication under NT4.0
       [not found] <01bdc0c8$e8a76a80$0f010180@nc84c>
@ 1998-08-05  0:00 ` vonhend
  1998-08-10  0:00   ` Mark
  0 siblings, 1 reply; 5+ messages in thread
From: vonhend @ 1998-08-05  0:00 UTC (permalink / raw)


In <01bdc0c8$e8a76a80$0f010180@nc84c>, "Mark" <wilson_m_r@yahoo.com> writes:
>Does anyone know how to interface (in both directions) an Ada executable
>with a C++ executable running on the same processor.
>
>Any replies via newsgroup please.
>
>Mark Wilson

Use the same techniques you would use to interface any two executables:
shared memory, mailboxes, sockets, whatever.  There is nothing magic about
an Ada executable.

Mark Von Hendy
Lockheed Martin Technical Ops





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

* Re: Ada to C++ communication under NT4.0
  1998-08-05  0:00 ` Ada to C++ communication under NT4.0 vonhend
@ 1998-08-10  0:00   ` Mark
  1998-08-10  0:00     ` Steve Doiel
  1998-08-13  0:00     ` Stephen Leake
  0 siblings, 2 replies; 5+ messages in thread
From: Mark @ 1998-08-10  0:00 UTC (permalink / raw)


I am well aware that there is nothing magic about an Ada executable!  The
main question concerns a C application and an Ada application running under
NT4.0 which require to share a large amount of data, therefore creating
significant overhead in terms of speed and memory usage if sockets or
mailboxes are used.  Shared memory would seem the best option in this case.
 If using shared memory then one of the applications would allocate the
address presumably, which the other would then overlay?  If this was the
case then would the passing of the address have to via mailboxes or sockets
since a direct call would not be possible?  Also, I am not sure how memory
would be allocated in NT4.0.  What happens when the memory is swapped to
disk?  Is all of this transparent to the application?  Someone has
suggested linking the two images together using our GNAT compiler.  Is this
possible?  I would not have thought so since presumably the Ada and C
applications would require separate run time systems to handle their
tasking.

More replies to newsgroup please.

Mark





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

* Re: Ada to C++ communication under NT4.0
  1998-08-10  0:00   ` Mark
@ 1998-08-10  0:00     ` Steve Doiel
  1998-08-13  0:00     ` Stephen Leake
  1 sibling, 0 replies; 5+ messages in thread
From: Steve Doiel @ 1998-08-10  0:00 UTC (permalink / raw)


Have a look at memory mapped files under NT.  This is the way shared memory
is generally handled under NT.

SteveD

Mark wrote in message <01bdc494$f3eab0d0$0f010180@nc84c>...
>I am well aware that there is nothing magic about an Ada executable!  The
>main question concerns a C application and an Ada application running under
>NT4.0 which require to share a large amount of data, therefore creating
>significant overhead in terms of speed and memory usage if sockets or
>mailboxes are used.  Shared memory would seem the best option in this case.
> If using shared memory then one of the applications would allocate the
>address presumably, which the other would then overlay?  If this was the
>case then would the passing of the address have to via mailboxes or sockets
>since a direct call would not be possible?  Also, I am not sure how memory
>would be allocated in NT4.0.  What happens when the memory is swapped to
>disk?  Is all of this transparent to the application?  Someone has
>suggested linking the two images together using our GNAT compiler.  Is this
>possible?  I would not have thought so since presumably the Ada and C
>applications would require separate run time systems to handle their
>tasking.
>
>More replies to newsgroup please.
>
>Mark
>






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

* Re: Ada to C++ communication under NT4.0
  1998-08-10  0:00   ` Mark
  1998-08-10  0:00     ` Steve Doiel
@ 1998-08-13  0:00     ` Stephen Leake
  1998-08-21  0:00       ` Gene Ouye
  1 sibling, 1 reply; 5+ messages in thread
From: Stephen Leake @ 1998-08-13  0:00 UTC (permalink / raw)


Mark wrote:
> 
> I am well aware that there is nothing magic about an Ada executable!  The
> main question concerns a C application and an Ada application running under
> NT4.0 which require to share a large amount of data, therefore creating
> significant overhead in terms of speed and memory usage if sockets or
> mailboxes are used.  Shared memory would seem the best option in this case.
>  <snip>
> Someone has
> suggested linking the two images together using our GNAT compiler.  Is this
> possible?  I would not have thought so since presumably the Ada and C
> applications would require separate run time systems to handle their
> tasking.

There are two issues in combining C++ and Ada into a single executable:
object file format and elaboration/finalization.

The current fully supported version of the GNAT compiler (3.11?)
supports the Microsoft object format, so it can link C++ compiled with
MS C++ with Ada compiled by GNAT. The current public version of GNAT
(3.10) can't do this. However, ObjectAda from Aonix uses the MS object
file format for Ada code; it can link with MS C++. Note that Borland
uses a different object file format, and can't link with any of these.

Another way around the object file format problem is to make DLLs. In my
current application, I use ObjectAda to make a DLL, and call it from
Borland C++. GNAT can also make DLLs.

The elaboration/finalization problem is solved by explicitly calling the
elaboration and finalization code that is normally called by "main". In
general, you can have either an Ada main that explicitly calls the C++
stuff, or a C++ main that explicitly calls the Ada stuff. The GNAT
user's guide has good instructions on how to call the GNAT
elaboration/finalization code. 

Multi-language programming is the best way to introduce people to Ada!

-- Stephe




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

* Re: Ada to C++ communication under NT4.0
  1998-08-13  0:00     ` Stephen Leake
@ 1998-08-21  0:00       ` Gene Ouye
  0 siblings, 0 replies; 5+ messages in thread
From: Gene Ouye @ 1998-08-21  0:00 UTC (permalink / raw)


FYI, Rational Apex Ada NT also uses the MS object file format and can
link with MSVC++ code.  However, as you mention below, DLLs are another
way to make multi-language applications in Windows.  I have found most
people find it simpler to create Ada DLLs (which you can do with Apex)
which can then called by any language you choose.

Gene Ouye <g.e.n.e.o.@.r.a.t.i.o.n.a.l...c.o.m>


Stephen Leake wrote:
 [...]
> There are two issues in combining C++ and Ada into a single executable:
> object file format and elaboration/finalization.
> 
> The current fully supported version of the GNAT compiler (3.11?)
> supports the Microsoft object format, so it can link C++ compiled with
> MS C++ with Ada compiled by GNAT. The current public version of GNAT
> (3.10) can't do this. However, ObjectAda from Aonix uses the MS object
> file format for Ada code; it can link with MS C++. Note that Borland
> uses a different object file format, and can't link with any of these.
> 
> Another way around the object file format problem is to make DLLs. In my
> current application, I use ObjectAda to make a DLL, and call it from
> Borland C++. GNAT can also make DLLs.
> 
> The elaboration/finalization problem is solved by explicitly calling the
> elaboration and finalization code that is normally called by "main". In
> general, you can have either an Ada main that explicitly calls the C++
> stuff, or a C++ main that explicitly calls the Ada stuff. The GNAT
> user's guide has good instructions on how to call the GNAT
> elaboration/finalization code.
> 
> Multi-language programming is the best way to introduce people to Ada!
> 
> -- Stephe




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

end of thread, other threads:[~1998-08-21  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <01bdc0c8$e8a76a80$0f010180@nc84c>
1998-08-05  0:00 ` Ada to C++ communication under NT4.0 vonhend
1998-08-10  0:00   ` Mark
1998-08-10  0:00     ` Steve Doiel
1998-08-13  0:00     ` Stephen Leake
1998-08-21  0:00       ` Gene Ouye

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