[fpc-devel] Apache header translation Patch

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Nov 12 10:39:13 CET 2007


On 12 Nov 2007, at 10:32, Inoussa OUEDRAOGO wrote:

> This is the c prototype ( type ) translated, actualy it is a array  
> of PCHAR.
>
> <code taken from apache source>
> const char *(*take_argv) (cmd_parms *parms, void *mconfig,
> 			     int argc, char *const argv[]);
> </code>
>
> Is the following translation valid ?
>
> take_argv_t = function (parms: Pcmd_parms; mconfig: Pointer; argc:
> cint; argv: array of PChar): PChar; cdecl;

I think it's better to do this:

take_argv_t = function (parms: Pcmd_parms; mconfig: Pointer;  
argc:cint; argv: PPChar): PChar; cdecl;

You can still index it as an array in FPC, but it's clearer what the  
actual type is that gets passed (an "array of pchar" is the same as a  
double pointer to char in C). I was indeed wrong about the varargs  
stuff I said earlier, for some reason I had read "array of pchar" as  
"array of const".


Jonas



More information about the fpc-devel mailing list