[Lazarus] Error: Got "Dynamic Array Of PChar", expected "PPChar"

Mattias Gärtner nc-gaertnma at netcologne.de
Fri Feb 26 11:48:41 CET 2010


Zitat von Osvaldo Filho <arquivostcf at gmail.com>:

> 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"

because "array of pchar;" is a Dynamic Array Of PChar and that is more  
than a 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}
> [...]
>           SetLength(ArgV, 2);
>           ArgV[0] := pchar(Prog);
>           ArgV[1] := nil;
>           FpExecv(Prog, ArgV);<<< Error
> [...]

Use
FpExecv(Prog, PPChar(@ArgV[0]));


Mattias







More information about the Lazarus mailing list