[fpc-pascal]Variable argument counts...

Jonas Maebe jonas at zeus.ugent.be
Sun Sep 19 22:13:17 CEST 2004


On 19 sep 2004, at 21:58, Gene Buckle wrote:

> I'm working on wrapping a C library that has a function that can 
> handle a
> variable number of parameters.  What mechanism can I use in FPC to call
> this correctly?
>
> The C prototype for the function looks like this:
>
> void QMCall(char * subrname, short int argc, ...);

procedure QMCall(subrname: pchar; argc: shortint; rest: array of 
const); cdecl; external;

You can then call it using

QMCall('test',1,['para1','para2',5,null]);

(I know you said it only needed strings, but it's just to show that you 
can pass anything that way, just like with "...").


Jonas





More information about the fpc-pascal mailing list