views:

428

answers:

3

I'm a complete Ada newbie, though I've used Pascal for 2-3 years during HS.

IIRC, it is possible to call Pascal compiled functions from C/C++. Is it possible to call procedures & functions written in Ada from C++?

+3  A: 

According to this old tutorial, it should be possible.

However, as illustrated by this thread, you must be careful with the c++ extern "C" definitions of your Ada functions.

VonC
Back in my Ada days I wrote libraries in Ada and was able to reference them in C programs so it is certainly possible.
cfeduke
A: 

Absolutely it's possible. For the past five years I've been working on a system that mixes C++ and Ada.

Fred Larson
Agreed that you answer his question - but it isn't providing a lot of insight.
Jonathan Leffler
I'm afraid I don't have much more insight than that. I haven't worked on the interface code. But then, the OP asked a yes/no question. 8v)
Fred Larson
A link or an example would be nice ;)
ceretullis
A: 

That kind of thing is done all the time. The trick is to tell both sides to use a "C"-style calling protocol for the routine. In C++ this is done with extern "C" declarations, and in the Ada side with pragma Export ("C", ...

Look those up in your favorite respective reference sources for details. Watch out for pointer and reference paramters!

T.E.D.