[fpc-devel] defines by the compiler... / linux, LIBC, SysCall
Martin Frb
lazarus at mfriebe.de
Thu Jan 11 15:48:37 CET 2024
Is this page up to date?
https://www.freepascal.org/docs-html/prog/progap7.html
Maybe I am wrong, but looking at the tsysteminfo does the value in
extradefines specify values that will be defined during compilation
(such as those given on that page)?
If the do then "sunos" has
extradefines : 'UNIX;LIBC;SUNOS;HASUNIX';
But neither LIBC nor HASUNIX are listed on that page.
-------
I don't have sunos for testing.
But https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40575
The primary target is to avoid compilation errors.
All the below guarded by {$ifdef linux}
1) I can add "uses SysCall".
There is a comment this will work in 3.3.1 / not sure if 3.2.x will
abort compile, or just use some unit without the expected symbol.
So the question is (for compilers starting at 3.2.0 // that is one
version back)
- Can (on any linux/unix) "uses SysCall" be compiled (without error)
- Does it need to be guarded {$IFnDEF LIBC} ?
2) If it can always be used, I can then check
{$IF declared(Do_SysCall)}
3) If Do_SysCall is not avail
Does FPC then provide the define LIBC?
So could I do
{$IF declared(Do_SysCall)}
// code uses Do_SysCall
{$ELSE}
{$IFDEF LIBC}
// code imports ptrace from libc
{$ELSE}
// code defines empty dummy "raise Exception.create('not
supported');"
// compiles, but wont work
{$ENDIF}
{$ENDIF}
Thanks for any help/feedback.
More information about the fpc-devel
mailing list