comp.lang.ada
 help / color / mirror / Atom feed
* Re: Passing complex structures between ADA and FORTRAN
       [not found] <mailman.1000467672.29280.comp.lang.ada@ada.eu.org>
@ 2001-09-14 14:08 ` Ted Dennison
  2001-09-14 15:37 ` Dan Nagle
  1 sibling, 0 replies; 2+ messages in thread
From: Ted Dennison @ 2001-09-14 14:08 UTC (permalink / raw)


In article <mailman.1000467672.29280.comp.lang.ada@ada.eu.org>,
joanna.chambers@bae.co.uk says...
>I am trying to pass structures, which in some places are 4 deep
>across from ada to Fortran and vice versa.  The integers are all
>single precision, but the real values are all double precision.
>However, the boundaries appear to be mixed up, and data is being lost
>and slipping to the next item in the structure when passed.  Changing

When you do cross-language data structure passing, you are going to need to
declare things on the Ada side either with "pragma Convention", or with a "for
use at" record representation clause to explicitly specify where every record
field is located.

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com
(posting via dialup. Our corporate internet access point was in Manhattan...)



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Passing complex structures between ADA and FORTRAN
       [not found] <mailman.1000467672.29280.comp.lang.ada@ada.eu.org>
  2001-09-14 14:08 ` Passing complex structures between ADA and FORTRAN Ted Dennison
@ 2001-09-14 15:37 ` Dan Nagle
  1 sibling, 0 replies; 2+ messages in thread
From: Dan Nagle @ 2001-09-14 15:37 UTC (permalink / raw)
  To: comp.lang.ada, joanna.chambers

Hi,

One possibility is that your Fortran compiler is choosing
to pad your derived type somehow.  The fact that your results
change when switching real kinds reinforces the likelihood
of this guess.

Advice:  use a standard Fortran derived type with the
sequence keyword within the derived type definition.
This causes the Fortran compiler to align components
of the derived type as if for a common block (so you
may need to use explicit padding components somewhere).
(The dot notation makes me think you might be using
VAX structures, use standard Fortran derived types
and standard Fortran % notation on the Fortran side.)

type :: foo_t
   sequence
   <put something here>
end type foo_t

Good Luck!

-- 
Cheers!

Dan Nagle
Purple Sage Computing Solutions, Inc.

On Fri, 14 Sep 2001 11:57:25 +0100, in comp.lang.ada you wrote:

>I am trying to pass structures, which in some places are 4 deep
>across from ada to Fortran and vice versa.  The integers are all
>single precision, but the real values are all double precision.
>However, the boundaries appear to be mixed up, and data is being lost
>and slipping to the next item in the structure when passed.  Changing
>the real values back to single precision helps a little, but it all
>goes pear shaped again, when it gets to a part of the structure which
>is a vector structure, eg
>Structure1.Structure2(n).Structure3.Item
>
>Can anyone advise on the best way to handle this.  I am afraid I
>don't have ready access to the newsgroup, so could you forward your
>replies to me at joanna.chambers@bae.co.uk
>
>
>
>
>
>********************************************************************
>This email and any attachments are confidential to the intended
>recipient and may also be privileged. If you are not the intended
>recipient please delete it from your system and notify the sender.
>You should not copy it or use it for any purpose nor disclose or
>distribute its contents to any other person.
>********************************************************************




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-09-14 15:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.1000467672.29280.comp.lang.ada@ada.eu.org>
2001-09-14 14:08 ` Passing complex structures between ADA and FORTRAN Ted Dennison
2001-09-14 15:37 ` Dan Nagle

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