From: comar@dantes.enst.fr (Cyrille Comar)
Subject: Re: Linking an ADA routine to a program written in C
Date: 1996/09/24
Date: 1996-09-24T00:00:00+00:00 [thread overview]
Message-ID: <COMAR.96Sep24165621@dantes.enst.fr> (raw)
In-Reply-To: 01bba5e0$cf06b040$328371a5@dhoossr.iquest.com
>>>>> "David" == David C Hoos, <david.c.hoos.sr@ada95.com> writes:
In article <01bba5e0$cf06b040$328371a5@dhoossr.iquest.com> "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com> writes:
David> This is an implementation-dependent thing. Generally what
David> has to be done is to tell the Ada compiler that the routine
David> is to be called by a C compilation unit. This is done with
David> a pragma such a EXPORT or EXTERNAL, depending on the
David> implementation. Consult your compiler documentation,
David> looking especially for discussions of Interface
David> Programming.
David> Further, the issue of "withed" packages pretty much
David> requires that your main program be an Ada program. If you
David> already have a suitable "main" program written in C, you
David> would need to put an Ada "wrapper" around the C main. The
David> C main might have to be renamed, depending on the Ada
David> implementation, because some Ada systems use a routine
David> called "main", which would confuse the linker of there were
David> two "main" symbols declared.
Sorry to jump in a bit late on this thread but I just wanted to add
that all the above description is perfectly correct for Ada83 but is
far from the reality of Ada (Ada 95). Interfacing with most other
languages is not implementation-defined anymore. This is perfectly
well defined in the R.M. See description of pragma Import/Export and
definition of standard procedures adainit (for elaboration of the Ada
part when main is not in Ada) and adafinal (for finalization of the
same Ada part). All of this is completely standard and implemented as
required at least in GNAT but most probably in other Ada95 compilers
as well.
Cyrille
next prev parent reply other threads:[~1996-09-24 0:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-09-18 0:00 Linking an ADA routine to a program written in C newmans
1996-09-18 0:00 ` Larry Kilgallen
1996-09-19 0:00 ` David C. Hoos, Sr.
1996-09-19 0:00 ` Larry Kilgallen
1996-09-20 0:00 ` Calius
1996-09-20 0:00 ` Chris Brand
1996-09-24 0:00 ` Cyrille Comar [this message]
1996-09-25 0:00 ` Larry Kilgallen
1996-09-26 0:00 ` Jens Jakob Jensen
-- strict thread matches above, loose matches on Subject: below --
1996-09-28 0:00 Robert Dewar
1996-09-28 0:00 ` Larry Kilgallen
1996-10-03 0:00 ` Robert Dewar
1996-10-04 0:00 Larry Kilgallen
1996-10-08 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox