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;
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:
-
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 assome_fn(ARRAY)
-
Does amibroker expect default values for all arguments? This wasn't the case for ODBC... but I'm also out of ideas...
-
Does amibroker 'test' call the functions and expect ASSERTions to fail, thus telling it how to define the user-defined functions?
-
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