comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic.brenta@insalien.org>
Subject: Re: Interfacing to C
Date: Tue, 08 Feb 2005 20:01:36 +0100
Date: 2005-02-08T20:04:51+01:00	[thread overview]
Message-ID: <87psza98q7.fsf@insalien.org> (raw)
In-Reply-To: 1107886078.800063.121210@f14g2000cwb.googlegroups.com

You're writing a binding to the "marktime" function.  Fine.  There are
problems with your binding, however.

In your package spec, you declare a procedure Marktime, which you
import.  The import is a "completion" in Ada reference manual terms;
this means that the procedure "marktime" is completely known after the
pragma Import line.

Per ARM 3.1.11(7), "At most one completion is allowed for a given
declaration."  Thus, the compiler will not look for other completions;
the procedure does not need a body (and indeed, providing a body is
illegal).

Except for the dummy procedure, nothing in your package spec needs a
completion (i.e. everything is completely defined by the spec).
Therefore, your package spec does not need a package body.

Per ARM 7.2(4), "A library package_declaration [...] shall not have a
body unless it requires a body; pragma Elaborate_Body can be used to
require a library_unit_declaration to have a body, if it would not
otherwise require one."

Here, I think the underlying problem is that you are trying to provide
two completions for procedure Marktime: the pragma Import and the
body.  You must choose one and remove the other.

-- 
Ludovic Brenta.



  parent reply	other threads:[~2005-02-08 19:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-08 18:07 Interfacing to C Garry
2005-02-08 18:43 ` Georg Bauhaus
2005-02-08 19:01 ` Ludovic Brenta [this message]
2005-02-08 19:27 ` Martin Krischik
2005-02-08 20:50 ` Björn Lundin
2005-02-09  7:27   ` Anders Wirzenius
2005-02-09 18:53     ` Garry
2005-02-09 21:35       ` Björn Lundin
  -- strict thread matches above, loose matches on Subject: below --
2009-12-24  9:46 RasikaSrinivasan@gmail.com
2009-12-24 10:01 ` Hibou57 (Yannick Duchêne)
2009-12-25  2:07   ` Keith Thompson
2009-12-31 23:18     ` Robert A Duff
2010-01-01 18:02       ` Keith Thompson
2009-12-24 12:34 ` Niklas Holsti
2009-12-24 14:26   ` RasikaSrinivasan@gmail.com
2009-12-28  7:20   ` Hibou57 (Yannick Duchêne)
2009-12-24 12:35 ` Vadim Godunko
replies disabled

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