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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,86f62fb0f98ad93e X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!k19g2000yqc.googlegroups.com!not-for-mail From: Rolf Newsgroups: comp.lang.ada Subject: Re: Passing Ada Proc as a C Function Pointer Date: Thu, 5 Aug 2010 00:33:15 -0700 (PDT) Organization: http://groups.google.com Message-ID: <60b8a494-fed1-4e0f-ba27-a2b7070d5818@k19g2000yqc.googlegroups.com> References: <581d2a1a-d7bb-48f5-9ca6-ae3c0e27c9bf@d17g2000yqb.googlegroups.com> NNTP-Posting-Host: 192.109.190.88 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1280993595 32441 127.0.0.1 (5 Aug 2010 07:33:15 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 5 Aug 2010 07:33:15 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k19g2000yqc.googlegroups.com; posting-host=192.109.190.88; posting-account=-RRRjAkAAAAGFvmHqTCN-L7gNQ7lRGfd User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322; InfoPath.2),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:12872 Date: 2010-08-05T00:33:15-07:00 List-Id: On 5 Aug., 02:45, Warren wrote: > On Aug 4, 3:46=A0pm, Simon Wright wrote: > > > I would be a bit worried about Thread_Proc's *Ada* environment. There's > > this thing called the Secondary Stack, used for - for example - string > > catenation; and it's not set up here. > > Yikes, that could be a problem. I vaguely remember something about > a "secondary stack". =A0I'm going to need to research this. The current version of AVR-Ada does not support the secondary stack. It is required for returning unconstrained objects from functions. Using unconstrained arrays already consumes so much of the valuable RAM that I never felt the need to support returning these objects from functions. BTW, GNAT-AVR (GPL 2010) from Adacore supports the secondary stack (and some other Ada features currently missing in AVR-Ada). > > I think you'll be OK so long as you restrain yourself! Twiddling LEDs > > should be OK. You can write quite complex programs without returning unconstrained objects! > > Well LED twiddling is just the "hello world" test. =A0I hope to do > a lot more than that, down the road! > > > There may be a pragma to prevent secondary stack usage? > > I'm all ears! ;-) pragma Restrictions (No_Secondary_Stack); It is already active if you use AVR-Ada. See the file gnat.adc Rolf