[fpc-pascal] os dependency with ifdef

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Fri Mar 17 19:26:59 CET 2006


Hello,

On 3/16/06, Marc Santhoff <M.Santhoff at t-online.de> wrote:
> Since I'm still fiddling with reading the serial port I have the idea
> that linux and even MacOS may be very similar to my main os FreeBSD.
>
> I do know Win32 is different, but how similar are the other os'ses?

You can mostly assume that if it works for Linux, then it will work
for FreeBSD and all other BSDs and even Solaris (and vice-versa).

This isnĀ“t true for Mac OS X. Althought it is based on FreeBSD, it is
very, very different from standard unix boxes.

> Is there any code in the FCL or the like I can study for getting my
> ifdefs right?

I used ifdefs to write two cross-platform projects: TTrayIcon
component and the Virtual Magnifying Glass. You can see their codes on
the internet.

For the magnifier, look for the LoadBitmap procedure to see a example
of how to use a ifdef to implement a function that is very different
on both platforms

http://cvs.sourceforge.net/viewcvs.py/magnifier/magnifierv3/glass.pas?rev=1.14&view=auto

TTrayIcon code is here:

http://www.freepascal.org/cgi-bin/viewcvs.cgi/trunk/components/trayicon/?root=lazarus

thanks,
--
Felipe Monteiro de Carvalho



More information about the fpc-pascal mailing list