Open angainor opened 5 years ago
// parentheses might help
BINDGEN_EXPORT_BINDING_2(add, add_impl, (vector, new_element),
"append an element to a vector");
// or (args or desc could be optional in this case, I think)
BINDGEN_EXPORT_BINDING_2(add, add_impl, BINDGEN_ARGS(vector, new_element),
BINDGEN_DESC("append an element to a vector"));
I would assume that we don't even need a new name for these, because we can detect the number of arguments to the macro.
This is mostly meant as a discussion, as I don't know if this functionality is possible / simple to implement.
Currently the generated Fortran bindings have generic argument names
arg<n>
:The generated bindings are hence not user-readable: the user cannot simply look at the Fortran module to know how to use the bindings, and instead must go elsewhere to look for the meaning of individual arguments. Either the C++ source code, or the documentation.
One way to improve this would be to allow the programmer to define the argument names, e.g., in the
BINDGEN_EXPORT_BINDING
macro. For examplecould generate the following interface
In a similar way before the interface definition one could place a comment to briefly explain the usage: