It's possible to do a lib with functions that accept variable args of variable type?, something like CallFunction()
in the .desc file the arguments are of fixed type so it seems not possible?
Lib with variable arguments of variable types?
Re: Lib with variable arguments of variable types?
If you're using Long as parameter type you can also pass string from
PureBasic if this helps (don't know if this is a feature though...).
Regarding varargs:
You'll need to make a different functions, 'real' varargs are not
supported.
PureBasic if this helps (don't know if this is a feature though...).
Regarding varargs:
You'll need to make a different functions, 'real' varargs are not
supported.
Code: Select all
2. Examples of variable parameters
- - - - - - - - - - - - - - - -
2.1 One, two or tree parameters
CustomBox, String, [Long], [Long], (Title$ [, Flags [, Hidden]]) - My Custom box
Long
Now, you have to create 3 PB functions, named like this:
PB_CustomBox (char *String)
PB_CustomBox2(char *String, Long)
PB_CustomBox3(char *String, Long, Long)
Good programmers don't comment their code. It was hard to write, should be hard to read.
Using 'Any', as Pupil said, is the right way. Here is for example the definition of CallFunction in the .desc:
Code: Select all
CallFunction, Long, String, [Any], [Any], [Any], [Any], [Any], [Any], [Any], [Any], [Any], [Any], [Any], [Any], [Any], [Any], [Any], [Any], [Any], [Any], [Any], [Any], (#Library, FunctionName$, [Arg1, [Arg2, ...]]) - Call a function using its name.
Long



