FFI-Platypus
FFI-Platypus copied to clipboard
Allow specification of direction of conversion for function parameters
Sometimes a function uses a parameter only for input or for output. In those cases, the type conversion code can be optimized to convert data in a single direction, rather than assuming that data will need to be converted both to- and from- Perl.
This could be accomplished by creating new types which are optimized for conversion directions. A simple means of indicating this would be to decorate the type names with <
and >
characters, indicating which direction conversion is required.
For example, >string
would convert from Perl to the foreign function, <string
would convert from the foreign function to Perl, and <>string
would perform bi-directional conversion.
This is something that Glib's introspection API has support for (via annotations): https://gi.readthedocs.io/en/latest/annotations/giannotations.html
(in) | parameters | In parameter. | v0.5.0 unknown
(out) | parameters | Out parameter (automatically determine allocation). | v0.5.0 unknown