[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #FST-907593]: netcdf-4.0 snapshot 2008100702: Fortran



> Hi Ed,
>
> have you thought about my patch for the Fortran configuration problem
> that I have on NEC SX?  The attached patch is still necessary to get
> a proper match between Fortran and C integer types with today's
> snapshot:
>
> Without it, config.h contains:
>
> #define NCBYTE_T integer
>
> which is wrong; with this patch I get:
>
> #define NCBYTE_T integer(selected_int_kind(2))
>
> Same thing for fortran/nfconfig.inc and fortran/nfconfig1.inc
>
> Regards,
> Harald
>
> --- netcdf-4.0.1-beta2-snapshot2009010202/acinclude.m4.orig   2008-10-06
19:08:25.000000000 +0000
> +++ netcdf-4.0.1-beta2-snapshot2009010202/acinclude.m4        2009-01-05
12:49:13.610052000 +0000
> @@ -420,9 +420,9 @@
> UD_CHECK_CTYPE_FORTRAN(real, float double, REAL)
> UD_CHECK_CTYPE_FORTRAN(doubleprecision, double float, DOUBLEPRECISION)
>
> -     UD_CHECK_FORTRAN_NCTYPE(NCBYTE_T, byte integer*1 integer, byte)
> +     UD_CHECK_FORTRAN_NCTYPE(NCBYTE_T, byte integer*1 "integer(kind=1)"
"integer(selected_int_kind(2))" integer, byte)
>
> -     UD_CHECK_FORTRAN_NCTYPE(NCSHORT_T, integer*2 integer, short)
> +     UD_CHECK_FORTRAN_NCTYPE(NCSHORT_T, integer*2 "integer(kind=2)"
"integer(selected_int_kind(4))" integer, short)
> dnl   UD_CHECK_FORTRAN_CTYPE(NF_SHORT_T, $NCSHORT_T, short, SHRT_MIN,
SHRT_MAX)
>
> dnl   UD_CHECK_FORTRAN_NCTYPE(NCLONG_T, integer*4 integer, long)
>

Howdy Harald!

The challenge with this patch is that it breaks the build for F77-only
situations. That is, a F77 compiler is not going to be able to figure out
selected_int_kind(4).

I guess that the ideal would be to see if the fortran compiler is a F90 one,
and, if so, use your patched lines, otherwise use the existing lines.

I am working on that now, but if you have any other thoughts about this, please
let me know.

Meanwhile, I hope to soon abandon this method of interfacing to fortran and
instead use the standard Fortran 2003 C interoperability layer. I am
experimenting with it in our libtool library, and I love it. It makes things a
lot more standard. So there is hope in the long term that these kinds of
fortran porting problems will be a thing of the past.

I'll let you know when the snapshot has been updated...

Thanks,

Ed



Ticket Details
===================
Ticket ID: FST-907593
Department: Support netCDF
Priority: Critical
Status: Open