Specifying function arguments to GetFunctionTable

I'm developing an AFL plugin. ( ie PLUGIN_TYPE_AFL )

I've managed to expose 4 functions to the AFL editor.
However, for the life of me, I can't figure out how to specify any arguments to those functions.

I'm reading the ADK, also following the Candle and ODBC examples but my caveat is that my plugin is written in Rust not C++ so it's not an exact 1 to 1.

For example, once the plugin is loaded, in the GetFunctionTable, I log the structures given to AmiBroker, regardless of what I give it, the script thinks these functions do not require any args and calls them fine with no arguments.
I also print out the number of args and args pointer, it's 0 and null;

image

The Rust code behaves in a similar way to C++, I can't see what I'm doing wrong.

pub extern "C" fn GetFunctionTable(ppFunctionTable: *mut *mut FunctionTag) -> c_int {

    ...

    let tag1 = FunctionTag::new("jag1( floatie )", 0, 0, 1, 0, null_mut(), some_fn1);
    let tag2 = FunctionTag::new("jag2", 1, 0, 0, 0, null_mut(), some_fn2);
    let tag3 = FunctionTag::new("jag3", 0, 1, 0, 0, null_mut(), some_fn3);

    // here i try to define an array of default values of 1
    // but it results in over 100 arguments
    let defaultTag4: *mut c_float = vec![2.5].as_mut_ptr();
    let tag4 = FunctionTag::new("jag4", 0, 0, 1, 1, defaultTag4, some_fn4);

    let mut fns = vec![tag1, tag2, tag3, tag4];
    *ppFunctionTable = fns.as_mut_ptr();

My questions are:

  1. Does amibroker only look at the Qty variables to work out how many args to expect, if so, why does it seem to expect no arguments for a function declared as "some_fn" { function_name, 1, 0, 0, 0, null } In AFL, this should appear as some_fn(ARRAY)

  2. Does amibroker expect default values for all arguments? This wasn't the case for ODBC... but I'm also out of ideas...

  3. Does amibroker 'test' call the functions and expect ASSERTions to fail, thus telling it how to define the user-defined functions?

  4. I did not see in the ADK, any mention of adding function hover over hints so eg, "some_fn( first_arg_type, second... )" { ... }, I'm wondering if I've got the latest doco. Is this an undocumented feature? I found it in ODBC/Functions.cpp

Thank you for reading,
Am really stuck and in need of help.
Joe

Here's another example to illustrate the point.

I have a function called "jag2( some_array )" defined like "jag2( some_array ), { some_fn2, 1, 0, 0, NULL }"

But when I try to call it with an array, it fails with error 16, Too many arguments:

image

Hum.... I just added a function to the end of the candle example and it works as expected... I'm doing something wrong with my implementation... Thanks for the CMake @Tomasz

image

Finally got it... it had to with the fact that a Rust struct is not a C struct by default, so the bytes were not correctly aligned. However, as the name was a pointer that started the struct, by some fluke that aligned...

I ended up just needing to include a trait to tell rust to make the struct like C expects it to be:
image