comp.lang.ada
 help / color / mirror / Atom feed
* Instanciation in a package spec.
@ 2003-01-22 10:22 Gautier direct_replies_not_read
  2003-01-22 17:53 ` Martin Dowie
  0 siblings, 1 reply; 11+ messages in thread
From: Gautier direct_replies_not_read @ 2003-01-22 10:22 UTC (permalink / raw)
  To: comp.lang.ada

In a package specification, I have:

  generic
    what: String;
  package Ad_hoc is
    function Last return String;
    procedure Add;
    procedure Put_Last;
  end Ad_hoc;

  package Ad_hoc_type is new Ad_hoc("type");

* ObjectAda 7.2.1 compiles it fine. But link fails:
pascalhe.obj : error LNK2001: unresolved external symbol 
pascalhelp.default_instanciations__elab_bool
haddock.obj : error LNK2001: unresolved external symbol 
pascalhelp.ad_hoc_type.add
haddock.obj : error LNK2001: unresolved external symbol 
pascalhelp.ad_hoc_type.put_last
haddock.exe : fatal error LNK1120: 3 unresolved externals

* GNAT 3.15p issues:
  pascalhe.ads:135:03: warning: cannot instantiate "Ad_hoc" before body seen
  pascalhe.ads:135:03: warning: Program_Error will be raised at run time

Who is right ? Of course I would like to keep is as I've
programmed, although there is surely a workaround by making
a new package with the instanciations. I'd prefer to avoid it.
________________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, e-mail address on the Web site!


_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail




^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: Instanciation in a package spec.
@ 2003-01-22 10:48 Grein, Christoph
  2003-01-22 16:54 ` Robert A Duff
  0 siblings, 1 reply; 11+ messages in thread
From: Grein, Christoph @ 2003-01-22 10:48 UTC (permalink / raw)
  To: comp.lang.ada

> * GNAT 3.15p issues:
>   pascalhe.ads:135:03: warning: cannot instantiate "Ad_hoc" before body seen
>   pascalhe.ads:135:03: warning: Program_Error will be raised at run time

Believe Gnat. It's a RM rule to forbid instantiations before elaboration of the body.



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

end of thread, other threads:[~2003-01-25 11:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-22 10:22 Instanciation in a package spec Gautier direct_replies_not_read
2003-01-22 17:53 ` Martin Dowie
  -- strict thread matches above, loose matches on Subject: below --
2003-01-22 10:48 Grein, Christoph
2003-01-22 16:54 ` Robert A Duff
2003-01-23 10:54   ` Jean-Pierre Rosen
2003-01-23 14:19     ` Robert A Duff
2003-01-23 15:13       ` Dmitry A. Kazakov
2003-01-23 16:23         ` Robert A Duff
2003-01-25 11:04           ` Dmitry A. Kazakov
2003-01-23 15:13       ` Jean-Pierre Rosen
2003-01-23 16:14         ` Robert A Duff

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