[fpc-pascal] units order (was using oldlinux )

Matt Emson memsom at interalpha.co.uk
Tue Jun 14 12:59:57 CEST 2005

Not a perfect solution, but the following solutions work:

1) create a unit for all clashing types to live in. Move all types that
clash to this central point and then use this unit anywhere that the clash

2) use the following trick in your local code:
  type TMyclashingType = UnitIWantToUse.TMyClashingType;

  so in your case:
  type PicHandle = common.PicHandle;

Solution 1 is more favourable though. Solution 2 will only work if luck is
on your side and you do not require procedures or functions from both units
that take the type as a param. Mind you, the above could be defined as:

type CommonPicHandle = common.PicHandle;
type FileUtilsPicHandle = FileUtils.PicHandle;

and so long as you do not use any structures based on them, all will be
fine. Structures (records) may also allow this trick, but then it's getting
into scoping issues and that can sometimes change from compiler to complier,
so I will not claim it will work.

All of this may or may not require Delphi mode - it certainly works in
Delphi mode.


More information about the fpc-pascal mailing list