Re: [fpc-pascal]Variable argument counts...

2004-09-19 Thread Gene Buckle
> > Yes, it's safe to ignore. It's a bug that that this warning is shown > when you declare the routine as external, it's only relevant if you > program the routine itself in Pascal (since then you can't use "for i > := low(args) to high(args) do ...", like you can for Pascal > array-of-const param

Re: [fpc-pascal]Variable argument counts...

2004-09-19 Thread Gene Buckle
> > You have to be in delphi or objfpc mode for this to work apparently. > Sorry I didn't look that up earlier. > > That did the trick, thanks! It does kick a warning though: Warning: cdecl'ared functions have no high parameter I wasn't able to find this in the documentation or the online forum

Re: [fpc-pascal]Variable argument counts...

2004-09-19 Thread Jonas Maebe
On 19 sep 2004, at 23:26, Gene Buckle wrote: That did the trick, thanks! It does kick a warning though: Warning: cdecl'ared functions have no high parameter I wasn't able to find this in the documentation or the online forum. Is this directly due to the declaration and is it safe to ignore? Yes,

Re: [fpc-pascal]Variable argument counts...

2004-09-19 Thread Jonas Maebe
On 19 sep 2004, at 22:58, Gene Buckle wrote: Ok, I made the change: procedure QMCall(SubrName : PChar; ArgCount : shortint; const Args : array of const); cdecl; external 'QMClient'; However, I still get the same error: QMClient.pas(30,79) Error: Type identifier expected QMClient.pas(30,79) Fatal:

Re: [fpc-pascal]Variable argument counts...

2004-09-19 Thread Gene Buckle
> Sorry, it should be > > > procedure QMCall(SubrName : PChar; ArgCount : shortint; const Args : > array of > const); cdecl; external 'QMClient'; > > (i.e., another "const" in front of "Args"). > > Ok, I made the change: procedure QMCall(SubrName : PChar; ArgCount : shortint; const Args : array of

Re: [fpc-pascal]Variable argument counts...

2004-09-19 Thread Jonas Maebe
On 19 sep 2004, at 22:34, Gene Buckle wrote: procedure QMCall(SubrName : PChar; ArgCount : shortint; Args : array of const); cdecl; external 'QMClient'; However, when I build it, I get an error: QMClient.pas(25,73) Error: Type identifier expected QMClient.pas(25,73) Fatal: Syntax error, ) expecte

Re: [fpc-pascal]Variable argument counts...

2004-09-19 Thread Jonas Maebe
On 19 sep 2004, at 22:30, Gene Buckle wrote: 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 tha

Re: [fpc-pascal]Variable argument counts...

2004-09-19 Thread Gene Buckle
> 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]); > My declaration reads like this: procedure QMCall(SubrName : PChar; ArgCount : shortint; Args : array of const); cdecl; ex

Re: [fpc-pascal]Variable argument counts...

2004-09-19 Thread Gene Buckle
> 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 "...")

Re: [fpc-pascal]Variable argument counts...

2004-09-19 Thread Jonas Maebe
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 a

[fpc-pascal]Variable argument counts...

2004-09-19 Thread Gene Buckle
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, ...); The function can handle up to 20