From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,4d062d5c58234698 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.68.202.68 with SMTP id kg4mr353082pbc.3.1355850821299; Tue, 18 Dec 2012 09:13:41 -0800 (PST) Path: 6ni51746pbd.1!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!novia!news-out.readnews.com!transit3.readnews.com!panix!newsfeed-00.mathworks.com!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: right compilation unit for C as main? Date: Tue, 18 Dec 2012 12:13:40 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 X-Trace: pcls6.std.com 1355850820 29388 192.74.137.71 (18 Dec 2012 17:13:40 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 18 Dec 2012 17:13:40 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:11X1iMXyxOagjBRwLlwRBB9deC4= Content-Type: text/plain; charset=us-ascii Date: 2012-12-18T12:13:40-05:00 List-Id: Brian Drummond writes: > adainit() should not block! It should set the environment up for Ada and > return to your C main program. Which will then call an ...ahhh, Ada > procedure which WILL block because the tasks it creates cannot outlive > it... That's true only if it declares objects containing tasks. If it allocates objects containing tasks via "new", with the access type declared at library level, then the tasks can outlive their creator. Tasks can also be created during library-package elaboration, which is called from adainit. > So this Ada procedure must create your Ada tasks, and then execute a C > function from its procedure body - your actual C code lives here. > > But given this structure I don't see why you don't just use an Ada main. Using an Ada main is usually easier, but using a C main is also possible, and sometimes necessary for reasons outside the Ada world. - Bob