Re: Macro to obtain kind parameter value in F90?

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

 



Hi Rhys,

* Rhys Ulerich wrote on Tue, Oct 12, 2010 at 05:11:24PM CEST:
> Can anyone recommend a macro for obtaining a kind parameter value in
> Fortran 90?  Or a macro where I might look for how to roll my own?

Have you looked at the Autoconf Macro Archive?  They have a couple of
Fortran-related macros.

Actually, I've been meaning to improve the autotools handling of Fortran
in general, and functionality such as you desire would IMVHO very much
fit in Autoconf proper.

> The check would be like AC_SIZEOF, but instead of returning the size
> it would return the kind parameter value (an integer).  AC_COMPUTE_INT
> would be perfect, but it appears to not work inside
> AC_LANG_PUSH([Fortran])/AC_LANG_POP([Fortran]) due to an error like
> 'AC_LANG_BOOL_COMPILE_TRY: unknown language: Fortran'.

Well, I for one wouldn't know how to do a cross-compile version of
AC_COMPUTE_INT.  (I looked into this a couple of years ago, and
concluded it wasn't possible with Fortran 77, but have all but forgotten
since.)  How would you do a non-cross-compile test?  Does Fortran have
a sizeof equivalent?  Does it have the notion of types that can differ
although their internal representation may be the same (as in C, where
int and long may have the same representation but are distinct types)?

> For the curious, I want the value so that I can wrap a C
> implementation with a public Fortran API that exposes types like
> REAL(4) instead of REAL(C_FLOAT).  The latter "leaks" ISO_C_BINDING
> information to clients while the former does not.

May I ask why the leaking would be a problem?

Thanks,
Ralf

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf


[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux