Ubuntu 9.10
Lazarus 0.9.29 revision 23749M (svn)
FPC 2,4,1 (svn)

Why do I have this error:

/mnt/laz_componentes/extpascal/CGIGateway.dpr(255,29) Error:
Incompatible type for arg no. 2: Got "Dynamic Array Of PChar",
expected "PPChar"

=============
{
Executes a program file
@param Prog Executable file with path
@return True if succeded else False
}
function Exec(Prog : string) : boolean;
{$IFNDEF MSWINDOWS}
var
  ArgV : array of pchar;
{$ENDIF}
begin
  {$IFDEF HAS_CONFIG}
  Result := true;
  if ConfigFile <> '' then
    if not Config.ReadBool(ConfigSection, 'Execute', true) then exit;
  {$ENDIF}
  // allow execution only on local machine
  Result := false;
  if (Host = 'localhost') or (Host = '127.0.0.1') then begin
    {$IFDEF MSWINDOWS}
    Result := ShellExecute(0, nil, pchar(Prog), nil, nil, 0) > 31
    {$ELSE}
    Result := false;
    case fpFork of
      -Maxint..-1 : Result := false;
      0 : begin
        FpSetSid; // set process as session leader
        // re-fork in order to enable session leader process get exited
        if fpFork = 0 then begin
          FpChDir(ExtractFilePath(Prog)); // make sure process path
          FpUMask(0); // reset umask
          // close all std
          FpClose(2);
          FpClose(1);
          FpClose(0);
          // open new std point to /dev/null
          FpOpen('/dev/null', O_RDWR);
          FpDup2(0, 1);
          FpDup2(0, 2);
          // run fcgi
          SetLength(ArgV, 2);
          ArgV[0] := pchar(Prog);
          ArgV[1] := nil;
          FpExecv(Prog, ArgV);<<< Error
        end;
        FpExit(0);
      end
    else
      Result := true
=============

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to