I would like to use the built-in Round() function, but its getting masked by the round() function if fp.pas in the Universal Interfaces, and they are not compatible (one returns a Integer, the other a double).
In the past, with other Pascal dialects, I have solved this by using System.Round() to get the built-in routine, but I don't believe this syntax is supported by GPC.
I could in theory arrange my uses clause to avoid using the fp unit, but as it turns out I only ever use Round() in routines that also require the fp unit's functions.
Is there a simple solution to this?
The simplest solution is to rename `round' from fp.pas on import like:
import fp (round => fp_round);
The `System.Round' syntax is supported, but ATM have different meaning: it requests `Round' form module `System'. In gpc `System' module does not export `Round' (and it have to be explicitly imported). Also, ATM gpc does not support exporting built-in indentifiers, so the best one can do is to make a little module like:
module gpcround; export gpcround = (RoundRealInt => Round); function RoundRealInt(r : Real): Integer; end; function RoundRealInt(r : Real): Integer; begin RoundRealInt := Round(r) end; end .
and then import `gpcround', for example like:
import qualified gpcround;
The second way requires gpc-20050217 (qualified indentifiers).