comp.lang.ada
 help / color / mirror / Atom feed
* Re: What's wrong with this?
  1997-05-16  0:00 What's wrong with this? Anders Eliasson
@ 1997-05-16  0:00 ` Robert Dewar
  1997-05-19  0:00   ` root
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Dewar @ 1997-05-16  0:00 UTC (permalink / raw)



Anders says

<<when compiled ( gcc -c filename ), generates the following error:

'pragma "Export" requires separate spec and must come before body'.

The example is directly out of the GNAT Documents INTRO Rev 1.98, from
the section 'Building a Program where the Main Program is not in Ada'.  I
have now seen various examples with 'pragma Export' used this way, the
implication is that this should work.>>


Nope, the example is wrong (and does not appear in the current GNAT 
documentation). The message is exactly right. Pragma Export cannot be
applied to a frozen entity, but a body freezes everything. So you
MUSt have a separate spec, and the pragma EXPORT must come before thhe
body -- typically it is associated with the spec (which makes sense, it
is certainly part of the interface!)





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

* What's wrong with this?
@ 1997-05-16  0:00 Anders Eliasson
  1997-05-16  0:00 ` Robert Dewar
  0 siblings, 1 reply; 3+ messages in thread
From: Anders Eliasson @ 1997-05-16  0:00 UTC (permalink / raw)



Will someone tell me why this:

with Text_Io; Use Text_Io;
procedure Header is
begin
  put_line ("Header");
end;
pragma Export (C, Header, "Header");

when compiled ( gcc -c filename ), generates the following error:

'pragma "Export" requires separate spec and must come before body'.

The example is directly out of the GNAT Documents INTRO Rev 1.98, from
the section 'Building a Program where the Main Program is not in Ada'.  I
have now seen various examples with 'pragma Export' used this way, the
implication is that this should work.

AE

Anders C. Eliasson
eliasson@logan.msfc.nasa.gov





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

* Re: What's wrong with this?
  1997-05-16  0:00 ` Robert Dewar
@ 1997-05-19  0:00   ` root
  0 siblings, 0 replies; 3+ messages in thread
From: root @ 1997-05-19  0:00 UTC (permalink / raw)



On 16 May 1997, Robert Dewar wrote:

> Anders says
> 
> <<when compiled ( gcc -c filename ), generates the following error:
> 
> 'pragma "Export" requires separate spec and must come before body'.
> 
> The example is directly out of the GNAT Documents INTRO Rev 1.98, from
> the section 'Building a Program where the Main Program is not in Ada'.  I
> have now seen various examples with 'pragma Export' used this way, the
> implication is that this should work.>>
> 
> 
> Nope, the example is wrong (and does not appear in the current GNAT 
> documentation).

Ok, the example is incorrect, no problem, however, I just ( as in 10
minutes ago ) downloaded the following:

gnat-3.09-i486-linux-elf-bin.tar.gz

from cs.nyu.edu, and I'm looking at the gnatinfo.txt file ( GNAT DOCUMENTS
INTRO $Revision 1.104$ ) included in this distribution.  In the section
'Building a Program where the Main Program is not in Ada' there is the
following example:

  Main program (m.c)

    main()
    {
      adainit();
      Header();
      adafinal();
    }

  Ada subroutine (header.adb)

    with Text_IO; use Text_IO;
    procedure Header is
    begin
       put_line ("Header");
    end;
    pragma Export (C, Header, "Header");

    Compile the units
    
      gcc -c m.c
      gcc -c header.adb
    
    Bind
    
      gnatbind -n header.ali
    
    Link
    
      gnatlink header.ali m.o
    
    Run
    
      header
 
As I understand the situation, gnat 3.09 is the latest release.  I guess
what I would like to know is, what is the latest documentation I'm
supposed to be looking at.  Also, if this example is incorrect, why is it
included in two releases of gnat ( 3.07 & 3.09 )?  This is confusing to
the newcomer :).

AE

address e-mail replies to:
eliasson@logan.msfc.nasa.gov





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

end of thread, other threads:[~1997-05-19  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-05-16  0:00 What's wrong with this? Anders Eliasson
1997-05-16  0:00 ` Robert Dewar
1997-05-19  0:00   ` root

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