[MITgcm-support] G95 build issue: f2c name mangling

Mark Hadfield m.hadfield at niwa.co.nz
Mon Oct 9 15:03:39 EDT 2006


chris hill wrote:
> Mark,
>
>  Can you try changing
>
>  system_time ==> systemtime
>  user_time   ==> usertime
>
>  in timers.F and timer_stats.c.
>
>  If I understood Ed correctly that should make the gnu linker happy. 
> If it seems to work for you we can try and change it permanently - it 
> shouldn't break anything else.
That won't work, as there are local variables called userTime and 
systemTime in timers.F. Obviously some other name would do.

The declarations for system_time and user_time in timers.F can (and in 
my opinion, should) be enclosed in an #if block, something like...

#if !defined HAVE_ETIME
      Real*8 system_time, user_time, timenow
      external system_time, user_time, timenow
#endif
      Real*8 timenow
      external timenow

...because these functions are only called when HAVE_ETIME is undefined. 
This fixes the problem, except for some hypothetical compiler that uses 
f2c linking and doesn't have etime.

The preprocessor logic in timers.F is pretty convoluted. I'm not sure if 
it's entirely right, either, eg if IGNORE_TIME is set, the only thing 
that's done is to set local variable wtime to zero, which seems rather 
pointless. I would try to clean it up, but I think I'll break something.


-- 
Mark Hadfield          "Kei puwaha te tai nei, Hoea tahi tatou"
m.hadfield at niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)






More information about the MITgcm-support mailing list