OK, found solution thanks to
/fpcsrc/3.2.2/rtl/linux/system.pp and his
SysInitExecPath procedure.
So this:
Program fpreadlink_test;
uses
baseunix;
var
pathexec : shortstring;
i : integer;
begin
pathexec[0]:=#0;
i := Fpreadlink('/proc/self/exe',@pathexec[1],high(pathexec));
if (i>0) and (pathexec[1]='/') then pathexec[0]:=char(i);
writeln(pathexec);
end.
Gives this (with the "/" at begin):
~> ./fpreadlink_test
/home/fred/fpreadlink_test
( and sorry for the noise)
Fre;D