Declares with variable length args

Is it possible to do Xojo declares to a function that has variable length arguments? And how would you declare the “…” ?

int a_function ( int x, … )
{
va_list a_list;
va_start( a_list, x );
}

Thanks

FUNCTION a_function(x as integer, y as integer=0, s as string="Default")

Y is optional, and if not supplied is ZERO
S is also optionald and if not supplied is the string “DEFAULT”

you can also OVERLOAD functions, but that is another discussion

So, there’s nothing like … I’d have to manually fill the variables with what I think may be needed i.e.: ?

Or only declare the int X and the rest will still be processed by the declared function?

int a_function ( int x, … )

Soft Declare a_function Lib “test.dylib” (x as integer, y as integer=0, s as string) As Integer

or

Soft Declare a_function Lib “test.dylib” (x as integer) As Integer

I think you just make several declares, one for each variant you need.

Soft Declare a_function Lib “test.dylib” (x as integer) As Integer
Soft Declare a_function Lib “test.dylib” (x as integer, y as integer) As Integer
Soft Declare a_function Lib “test.dylib” (x as integer, y as integer, s as Cstring) As Integer
Soft Declare a_function Lib “test.dylib” (x as integer, y as integer, s as Cstring, f as integer) As Integer

Like I said… OVERLOADS is a whole nother discussion…

And I think your use of “declare” is not the same as what Christian interpeted it be.

oh, sorry. I thought it was about declare statement with a C function.

Not for declaring variable parameters in Xojo, please check paramArray key word and also default parameters like Dave pointed out.

I may not have been clear on my first post, tried to be a little more clear on the second.

Anyhow, thanks for the answer.

You could try to wrap libffi libffi.