On Fri, 26 Aug 2005, Tim Jenness wrote:
> g95 seems to require that all C programs that go through C main initialise
> the RTL, else I get core dumps everywhere. (maybe that's a bug in g95 but
> it cores in memory allocation routines and in Fortran I/O. g77 only seems
> to need argument lists initalised)
Tim,
that's a documented feature of g95, see:
http://g95.org/docs.html
down at the bottom "Interfacing with g95 programs".
For C calling fortran subroutines, the fortran subroutines will often
call fortran library subroutines that expect the heap to be initialized
in some way.
so calling g95_runtime_start() is clearly a requirement.
> I'd also like to sort out the AC_FC_MAIN issue since g95 requires this
> symbol to be present even if it is just a stub. Maybe something along the
> lines of
>
> #if AC_FC_MAIN != main
> void AC_FC_MAIN () {}
> #endif
>
> would do the trick?
I wondered if it would be better to say define the default function
returned by FC_MAIN:
FC_MAIN([pkg_dummy_main])
the default being as now (main).
Peter.
|