comp.lang.ada
 help / color / mirror / Atom feed
From: "braver" <deliverable@gmail.com>
Subject: Re: Memory limits in Ada where Fortran has none
Date: 6 Mar 2005 08:14:21 -0800
Date: 2005-03-06T08:14:21-08:00	[thread overview]
Message-ID: <1110125661.857477.251640@o13g2000cwo.googlegroups.com> (raw)
In-Reply-To: <1260026.XKFy62IHbW@linux1.krischik.com>

My working solution is probably what you mean by access function.

I could import a Fortran variable from a subroutine by compiling the
Fortran module with -fno-automatic, but then I'd still have to declare
it in Ada first -- and hit the size limit, or try to turn off index
checking, which is bothersome.

So instead, I keep the array in Fortran.  And as Ada's array access was
designed to look the same as a (memoized) function, Fortran being the
same, I declare, in Fortran,

      FUNCTION ND(I)
      COMMON /NDD/NNDD
      DIMENSION ND(PARAMETER MMAX=100 000 000)
      ND = NNDD(I)
      RETURN
      END

and in Ada,

   function ND(I: Positive) return Integer;

   pragma Import (Fortran, ND,
                    External_Name=> "ND",
                    Link_Name=> "nd_"
        );

   pragma Inline(ND);

-- import ND, inline it, et voila!  I create a package Lord_Fortran to
do the importing/inlining, and just with/use it.  It is actually
surprisingly fast even without turning off range checking.

>From now on, I allocate data arrays longer than 256*256*1024 elements
in Fortran.  As people guessed correctly, I use GNAT -- what else can I
do on Linux, given I can't find a downloadable/trial copy of Rational
Apex, even though IBM took over it?  As for patches -- anyone heard of
a 32-bit 'Size / 'Storage_Size patch to GNAT?

Cheers,
Alexy




  reply	other threads:[~2005-03-06 16:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-06  0:54 Memory limits in Ada where Fortran has none braver
2005-03-06  1:09 ` Jeff C
2005-03-06  6:18   ` braver
2005-03-06  9:26     ` Martin Krischik
2005-03-06 16:14       ` braver [this message]
2005-03-06 16:28         ` Jeff C
2005-03-06 23:09         ` Craig Carey
2005-03-07  0:36           ` braver
2005-03-07  5:55           ` braver
2005-03-08  5:35             ` braver
2005-03-06 14:09     ` Stephen Leake
2005-03-06  9:33 ` Martin Krischik
2005-03-06 22:13 ` Gerald
2005-03-06 23:01 ` Dr. Adrian Wrigley
2005-03-07  0:31   ` braver
2005-03-07 12:47     ` Dr. Adrian Wrigley
2005-03-07  9:41   ` Martin Krischik
2005-03-07 11:59     ` Dr. Adrian Wrigley
2005-03-07 12:26       ` Martin Krischik
2005-03-07  0:05 ` Robert A Duff
2005-03-07 18:04   ` braver
2005-03-16 19:41     ` Robert A Duff
2005-03-17 18:49       ` Martin Krischik
2005-03-08 11:24   ` Dr. Adrian Wrigley
2005-03-09  3:39     ` Craig Carey
2005-03-16 17:39       ` Craig Carey
2005-03-16 19:51     ` Robert A Duff
2005-03-16 23:47       ` Dr. Adrian Wrigley
replies disabled

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