From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Possible compiler bug with this simple program
Date: Wed, 3 Sep 2008 22:53:45 -0500
Date: 2008-09-03T22:53:45-05:00 [thread overview]
Message-ID: <g9nm81$bbd$1@jacob-sparre.dk> (raw)
In-Reply-To: 90006a35-e933-40f1-9a76-5698b0ce75d1@s20g2000prd.googlegroups.com
"Adam Beneschan" <adam@irvine.com> 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.
next prev parent reply other threads:[~2008-09-04 3:53 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-28 7:28 Possible compiler bug with this simple program Jerry
2008-08-28 7:56 ` Ludovic Brenta
2008-08-28 21:08 ` Jerry
2008-08-29 20:39 ` Ludovic Brenta
2008-08-29 21:20 ` Jerry
2008-08-29 21:31 ` Jerry
2008-09-02 22:10 ` Santiago Urueña
2008-08-28 8:03 ` Niklas Holsti
2008-08-28 15:54 ` Adam Beneschan
2008-08-28 15:56 ` Adam Beneschan
2008-08-28 21:01 ` Randy Brukardt
2008-08-28 21:29 ` Jerry
2008-08-30 1:00 ` Randy Brukardt
2008-08-30 4:47 ` Jerry
2008-09-01 11:19 ` Jerry
2008-09-03 4:22 ` Jerry
2008-09-03 14:20 ` Adam Beneschan
2008-09-04 0:22 ` Jerry
2008-09-04 1:18 ` Adam Beneschan
2008-09-04 3:53 ` Randy Brukardt [this message]
2008-09-04 1:31 ` Jeffrey R. Carter
2008-09-04 14:35 ` Adam Beneschan
2008-09-04 14:42 ` Jacob Sparre Andersen
2008-09-06 3:03 ` Jerry
2008-09-05 8:17 ` Ludovic Brenta
2008-09-05 15:56 ` Adam Beneschan
2008-09-05 17:09 ` Jeffrey R. Carter
2008-09-04 20:49 ` Simon Wright
2008-08-28 21:16 ` Jerry
2008-08-29 7:41 ` Niklas Holsti
2008-08-30 0:50 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox