Order of arguments for DLL function

I am writing my first AFL Plugin, and can build the Sample DLL using Visual Studio 2022 and call DLL functions from 64-bit AmiBroker. Also, I have seen this note in the ADK documentation:

Note that AFL allows unlimited number of arguments but the order is fixed: first come the array arguments, then string arguments, then numeric arguments with no defaults and at the end - numeric arguments with default values.

Indeed, the AFL syntax checker seems to assume that the function arguments will be in that order, which is the same order used in the Function Table.

My question is whether there is any way to specify a different order of the argument types expected by my DLL function? For example, if I wanted to create my own function similar to StaticVarSet, I would want the argument types to be "string, array", not "array, string". More specifically, since I am replacing user functions written in AFL which did NOT have the argument types in "array, string, float" order, it would be nice to keep the order of the arguments the same.

You can have "string", array in that order if you define your FunctionTable item like this

		"YourFunction( \"string\", array )", { YourFunction, 0, 1, -1, 0, NULL },

-1 at that position means 1 argument of float OR array type. You must then detect the type of argument passed and act accordingly.

1 Like

Perfect, thanks for the additional information.