ASM allowed in Fortran? and OpenDir?

Janne Blomqvist blomqvist.janne@gmail.com
Wed Aug 8 08:59:00 GMT 2007


On 8/8/07, FX Coudert <fxcoudert@gmail.com> wrote:
> >     integer :: dirid
> >     integer :: jdirent
> >     integer :: pxferr
> >
> >     call pxfopendir (mydir, len (mydir), dirid, pxferr)
>
> This assumes that the directory id can fit in an integer, which might
> be an issue for 64bit platforms, isn't it?

Not just 64-bit platforms, any systems with LFS, which includes pretty
much everything released within the last 5 years. Though I suppose few
filesystems have more than 2**31 inodes, so with some luck the 32 bits
that are getting truncated are all zero anyway. Of course, when you do
hit that bug it'll be one of those infuriating "works on system A and
not on system B, although they have identical software". Here's how it
looks over here:

struct dirent
  {
#ifndef __USE_FILE_OFFSET64
    __ino_t d_ino;
    __off_t d_off;
#else
    __ino64_t d_ino;
    __off64_t d_off;
#endif
    unsigned short int d_reclen;
    unsigned char d_type;
    char d_name[256];           /* We must not include limits.h! */
  };

#ifdef __USE_LARGEFILE64
struct dirent64
  {
    __ino64_t d_ino;
    __off64_t d_off;
    unsigned short int d_reclen;
    unsigned char d_type;
    char d_name[256];           /* We must not include limits.h! */
  };
#endif


Looking at Walters code, I suppose supporting even a withdrawn
standard would be better than nothing, but the contortions PXF* goes
through to access C from F77 looks rather painful. Some F90+-iy
interface making use of derived types would surely be much nicer (I
suppose PXF90 doesn't exist?).


-- 
Janne Blomqvist



More information about the Fortran mailing list