comp.lang.ada
 help / color / mirror / Atom feed
From: mockturtle <framefritti@gmail.com>
Subject: Re: Learning Ada but missing the basics?
Date: Mon, 30 Jun 2008 14:18:04 -0700 (PDT)
Date: 2008-06-30T14:18:04-07:00	[thread overview]
Message-ID: <be473d92-aaf2-4235-8dc1-4e4bacda54c8@b1g2000hsg.googlegroups.com> (raw)
In-Reply-To: c287aa77-8392-4176-b6b0-c021d0190d36@z72g2000hsb.googlegroups.com

On Jun 30, 10:38 pm, ryan k <r...@ryankaskel.com> wrote:
> On Jun 30, 4:19 pm, Keith Thompson <ks...@mib.org> wrote:
>
>
>
> > ryan k <r...@ryankaskel.com> writes:
> > > I'm trying to learn Ada because a) I think it's cool to learn new
> > > computer languages and b) it looks like a good one. I've gone the
> > > through a lot of the tutorials but lets say have package MyPackage and
> > > 5 subprograms are in the body. Which procedure is run first? Is it
> > > sequential?
>
> > None of them will run unless they're called.
>
> > >             Is there some sort of equivalent to C's main()?
>
> > Not exactly.  There's no special name for the entry point.  You
> > specify it when you link the program.
>
> > >                                                             Is a
> > > binary created for every package?
>
> > That depends on what you mean by "a binary".  There typically won't be
> > an executable created for each package.  An Ada package is similar in
> > some ways to a separately compiled C source file; you can combine
> > several of them, along with a procedure that's specified to be the
> > main program, into a single program.  The details of how you do this
> > are defined by each implementation, not by the language.
>
> > >                                   I guess I don't understand where
> > > things start and end. Any help or links are greatly appreciated!
>
> > --
> > Keith Thompson (The_Other_Keith) ks...@mib.org  <http://www.ghoti.net/~kst>
> > Nokia
> > "We must do something.  This is something.  Therefore, we must do this."
> >     -- Antony Jay and Jonathan Lynn, "Yes Minister"
>
> I use the GNAT compiler. How then do I specify the main procedure?
>
> Thanks.

I remember I had the same problem when I began... ;-)

Just write a file some_name.adb with a procedure some_name in it.
When you use

        gnatmake some_name

GNAT will take care of all the dependencies and will create
an executable file "some_name".  When you run it, the procedure
some_name will be executed.
(BTW, is not this great? No *#$% Makefiles...)

For example, here it is the typical "Hello World"

-- BEGIN File hello_world.adb
with Text_Io;

procedure Hello_World is
begin
  Text_Io.Put_Line("Hello World!");
end Hello_World;
-- END File hello_world.adb

Disclaimer: I wrote the code above "on the fly" and I did not
check if it compiles, although it should...




  reply	other threads:[~2008-06-30 21:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-30 19:01 Learning Ada but missing the basics? ryan k
2008-06-30 20:19 ` Keith Thompson
2008-06-30 20:38   ` ryan k
2008-06-30 21:18     ` mockturtle [this message]
2008-06-30 21:48 ` Jeffrey R. Carter
2008-07-01  1:15   ` ryan k
2008-07-01  2:56     ` Tero Koskinen
2008-07-01  3:13     ` Jeffrey R. Carter
2008-07-02  3:02     ` DScott
2008-07-02  9:18     ` Pascal Obry
2008-07-02 15:54       ` Alex R. Mosteo
2008-07-02 17:17         ` Georg Bauhaus
2008-07-03  8:09           ` Alex R. Mosteo
2008-07-04 17:08         ` Simon Wright
2008-07-04 17:39           ` Pascal Obry
2008-07-08  8:23           ` Alex R. Mosteo
2008-07-08  9:47             ` Jean-Pierre Rosen
2008-07-02 17:47     ` Gautier
2008-07-01 20:51 ` John McCormick
replies disabled

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