[fpc-devel] Portability Standards

Tomas Hajny XHajT03 at mbox.vol.cz
Mon Jan 3 08:28:48 CET 2005


On Sun, 2 Jan 2005 23:35:10 +0100 (Romance Standard Time), Michael Van Canneyt
wrote
> On Sun, 2 Jan 2005, DrDiettrich wrote:
> 
> > Michael Van Canneyt wrote:
 .
 .
> > 2) File Restructuring
> > I've separated the spaghetti code in AbUtils.pas into distinct MSWINDOWS
> > and UNIX sections, each containing complete procedures. These sections
> > could be moved into dedicated OS specific include files - what's the
> > preferred way?
> 
> {$ifndef unix}
> {$i abiuwin.inc} // more to follow later: e.g. Mac OS, Netware etc.
> {$else}
> {$i abiulin.inc}
> {$endif}

There's at least one (IMHO not worse at least) alternative to that (already
used in FPC itself among others) - keep the include file name the same, place
it in separate directories for different targets (like UNIX, WIN32, etc.) and
provide the right paths using a Makefile (see e.g. fcl/Makefile.fpc + Makefile
in our source tree). The advantage of this approach is that you don't need any
ifdefs at all (especially when there are more targets supported it could get
somewhat messy).

Tomas





More information about the fpc-devel mailing list