casting on 64/32-bit environment

Andrew Haley aph-gcc@littlepinkcloud.COM
Wed Oct 24 10:03:00 GMT 2007


Tim Prince writes:
 > Andrew Haley wrote:
 > 
 > > Well, if this data structure is shared with FORTRAN you'll have to do
 > > something similar on the FORTRAN side.  It'll be a different type:
 > > INTEGER*8 or somesuch.  I'm not a FORTRAN programmer.
 > > 
 > > But yes, long will work on all gcc targets I'm aware of.
 > 
 > All maintained Fortran compilers, including gfortran, support c_ptr
 > data type.  You can't very well port intentionally non-portable
 > stuff to a different architecture unless you correct such
 > anachronisms.

Hehe.  As far as I'm concerned, FORTRAN 77 is dangerously harmful
modernity.  :-)

To Mitja:

  Change the type on the C side of the interface to intptr_t.
  Change the type on the FORTRAN side of the interface to c_ptr.

Then you'll have a program that is portable to 32-bit and 64-bit
systems.

Thanks,
Andrew.



More information about the Gcc-help mailing list