On Mon, 11 Jul 2005, Andres K. Foerster wrote:
Am Monday, dem 11. Jul 2005 schrieb Michael Van Canneyt:
Hello,
how can I test - at runtime - under which OS (Linux, Windows and so on) a
FPC-program is running?
Try
Var
ThisOS : String;
begin
ThisOS := {$I %FPCTARGET%};
results in a string of the form i386-linux or i386-win32.
But it is also just the platform the program is compiled for.
It doesn't work when you run with an ABI for a different system,
ie. you run a FreeBSD binary on NetBSD.
That shouldn't matter to the program. If I run a Windows binary on Linux
under wine, the binary will assume it is running on Windows. Similarly,
a linux binary running on BSD will assume it runs on Linux. It's up to
the emulator to be 'perfect'.
In other words, an emulator should not be detected, and the program can
be assumed to be running on the OS it was compiled for...
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal