comp.lang.ada
 help / color / mirror / Atom feed
* Ada C++ interface
@ 1999-07-12  0:00 Martin
  1999-07-12  0:00 ` Decker, Christian R
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Martin @ 1999-07-12  0:00 UTC (permalink / raw)


I'm quite new in Ada programming and I have been tasked with the job to
make a C++ interface to an existing package/library programmed in Ada
95.

I've got Gnat 3.11 downloaded from the net and we are using Borland C++
Builder for the user interface and we are using Windows NT.  I've
finished som wrapping code in Ada and C++ testing on Sun Solaris and are
now trying to integrate this with a Borland C++ Builder user interface
on Windows NT.

First I tried to just compile and link this together but the Borland
linker does not like Gnat objects and the Gnat linker does not like
Borland objects.  Next step could be to compile the Ada into a DLL that
I could use from the Borland code:
Do you know how to do that with the Gnat compiler?
or do you have any other tip?

Thank you,

Martin Myran






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

* Ada C++ interface
  1999-07-12  0:00 Ada C++ interface Martin
@ 1999-07-12  0:00 ` Decker, Christian R
  1999-07-12  0:00 ` Ted Dennison
  1999-07-12  0:00 ` David Botton
  2 siblings, 0 replies; 4+ messages in thread
From: Decker, Christian R @ 1999-07-12  0:00 UTC (permalink / raw)


Check the previous threads on this one... there have been many discussions
on this topic.

The basic problem with interfacing Ada to C++ is the fact that C++ compilers
perform 'name mangling'
on the obejct files.  This causes the Ada lonker to have many unresolved
external errors during link time.

Your C++ code being interfaced must have the extern "C" applied to it in
order to prevent the name mangling.

Good Luck!

Chris



   -**** Posted from RemarQ, http://www.remarq.com/?a ****-
 Search and Read Usenet Discussions in your Browser - FREE -




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

* Re: Ada C++ interface
  1999-07-12  0:00 Ada C++ interface Martin
  1999-07-12  0:00 ` Decker, Christian R
@ 1999-07-12  0:00 ` Ted Dennison
  1999-07-12  0:00 ` David Botton
  2 siblings, 0 replies; 4+ messages in thread
From: Ted Dennison @ 1999-07-12  0:00 UTC (permalink / raw)


In article <i3gi3.15$Gf1.286@news1.online.no>,
  Martin <Martin.Myran@Thomson-CSF.no> wrote:

This is a gnat-only question, and thus would have had better response
posted to gnat chat ( http://www.gnat.com/gnatchat.html ). I'd highly
suggest reposting your question there.

> I've got Gnat 3.11 downloaded from the net and we are using Borland
C++
> Builder for the user interface and we are using Windows NT.  I've

The only way to link Gnat-compiled objects to source compiled with VC++
is via a DLL. Unless Borland has something setup to support gcc, you are
probably in the same boat.

> Borland objects.  Next step could be to compile the Ada into a DLL
that
> I could use from the Borland code:
> Do you know how to do that with the Gnat compiler?

The following message from the Gnat-chat archives describes how to do
that: http://www.gnat.com/chat/3263.html

--
T.E.D.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




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

* Re: Ada C++ interface
  1999-07-12  0:00 Ada C++ interface Martin
  1999-07-12  0:00 ` Decker, Christian R
  1999-07-12  0:00 ` Ted Dennison
@ 1999-07-12  0:00 ` David Botton
  2 siblings, 0 replies; 4+ messages in thread
From: David Botton @ 1999-07-12  0:00 UTC (permalink / raw)


Since you are trying to use Ada from C++ make sure that you wrap all the C
prototypes for Ada with an extern "C" block.

There are two examples of creating DLLs with GNAT on AdaPower.com one of
which also demonstrates how to use Ada functions from C.

Take a look at:

* Using GNAT Dlls from C (van Dijk & Marceau)
* Create DLLs with GNAT (Derks)

In the articles section at http://www.adapower.com

David Botton



Martin wrote in message ...
>I'm quite new in Ada programming and I have been tasked with the job to
>make a C++ interface to an existing package/library programmed in Ada
>95.
>
>I've got Gnat 3.11 downloaded from the net and we are using Borland C++
>Builder for the user interface and we are using Windows NT.  I've
>finished som wrapping code in Ada and C++ testing on Sun Solaris and are
>now trying to integrate this with a Borland C++ Builder user interface
>on Windows NT.
>
>First I tried to just compile and link this together but the Borland
>linker does not like Gnat objects and the Gnat linker does not like
>Borland objects.  Next step could be to compile the Ada into a DLL that
>I could use from the Borland code:
>Do you know how to do that with the Gnat compiler?
>or do you have any other tip?
>
>Thank you,
>
>Martin Myran
>
>






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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-12  0:00 Ada C++ interface Martin
1999-07-12  0:00 ` Decker, Christian R
1999-07-12  0:00 ` Ted Dennison
1999-07-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