Closed Boddlnagg closed 6 years ago
This is mostly done in #24. The only case left is dealing with arrays as output parameters, where a safe API would require a mutable, write-only, empty slice, e.g. in ISpiDevice.read(...)
.
Maybe it's helpful that the arrays in those remaining cases are always (at least until now) arrays of value types (primitives or structs) ... which means that those arrays are easily constructible (because the elements are Copy
) and the elements don't have destructors. So maybe taking &mut [T]
is not too bad after all.
Array types in method parameters are currently (hopefully) correct in the raw VTable definitions, but not yet idiomatically represented in the wrapper methods. (Array parameters are taken as raw pointers and just forwarded directly.)
https://msdn.microsoft.com/en-us/library/hh700131.aspx shows how arrays are handled in C++/CX. Also have a look at
vccorlib.h
(part of Visual Studio installation) for the definitions ofPlatform::Array
, etc.