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,e5a3abec221df39 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Possible compiler bug with this simple program Date: Wed, 3 Sep 2008 22:53:45 -0500 Organization: Jacob's private Usenet server Message-ID: References: <1edc3682-855f-405b-8348-72b423377b1a@i20g2000prf.googlegroups.com> <48b65b3b$0$25384$4f793bc4@news.tdc.fi> <97b1150b-cb8f-4972-b594-2ae59af84147@x16g2000prn.googlegroups.com> <8c8e5e62-16e1-4442-a6e9-f4e63fbed7a8@a8g2000prf.googlegroups.com> <903354c9-7780-4843-a5a3-dd2c40903d40@p31g2000prf.googlegroups.com> <2da4989c-4c97-43e9-8102-ba99389fdea9@v16g2000prc.googlegroups.com> <0494a60a-a452-436b-86f9-844b398aab4f@b38g2000prf.googlegroups.com> <5ca524f3-0fde-4c3b-b1a0-fe2281180ef3@k36g2000pri.googlegroups.com> <90006a35-e933-40f1-9a76-5698b0ce75d1@s20g2000prd.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1220500545 11629 69.95.181.76 (4 Sep 2008 03:55:45 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 4 Sep 2008 03:55:45 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 Xref: g2news2.google.com comp.lang.ada:7632 Date: 2008-09-03T22:53:45-05:00 List-Id: "Adam Beneschan" wrote in message news:90006a35-e933-40f1-9a76-5698b0ce75d1@s20g2000prd.googlegroups.com... ... >> The difference between the two cases ([1] described above, herein, and >> [2] the code in mixed Ada and C that I posted earlier), is that in >> [1], both the called procedure and the callback procedure are written >> in C, and the in problematic code [2], the called subprogram is in C >> (plmap) but the callback (mapform19) is written in Ada, with C >> conventions. > > Yup, this is not surprising at all to me. And if you go back and > reread my earlier post, I believe I explained pretty thoroughly why > this is happening, and also gave you a solution. Don't use an > unconstrained array type in your callback routine. Period. You can > use unconstrained arrays when calling C routines from Ada; but if > you're going to call Ada routines from C, don't. Right. It is *only* OK to use an unconstrained array parameter in a subprogram that has pragma Import. It is *not* OK in any other context for C (objects, subprograms with Convention or Export pragmas, function returns of any kind). Your program is still using pragma Convention and you are still having C call Ada with an unconstrained parameter. You can't do that portably. I may have not looked carefully enough at your original program; I presumed that reason you were using pragma Convention was so that you could write the routine in Ada, and that it would be replaced by pragma Import in the real program. If that was wrong, I probably mislead you. Randy.