You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need some kind of collection support. One option would be implementing COM SAFEARRAY <-> Rust [T] slice.
At least the following things should be possible:
Rust
// Collection parameters and return value.fnmethod(&self,values:[u8]) -> Vec<bool>{ ...}
COM clients
vararr= list.ToArray();foreach(var item in foo.Method( arr )){ ...}
Even if we need to go with the SAFEARRAY approach, we don't need to support the full SAFEARRAY to begin with. We could even make the assumption that the SAFEARRAYs can only be used in methods that return ComResult (or similar) and thus the SAFEARRAY conversion methods can yield E_INVALIDARG in bad cases to report invalid use of SAFEARRAYs.
The text was updated successfully, but these errors were encountered:
While SAFEARRAY is a horrible construct, I'm feeling more and more convinced that we need to support it for things like C#. On the other hand we do NOT want to support it for things like native C++ unless we really need to.
As such, my current proposal would be:
TypeSystem::Automation will use SAFEARRAYs everywhere, TypeSystem::Raw will use size_t/Data* pairs for collections.
In either case only one-dimensional arrays will be supported (even if SAFEARRAY could support multi-dimensional arrays).
We'll provide a macro, such as define_com_collection!(u8 -> U8Collection), that ends up creating the #[repr(C)] types for the array and impls ExternType for [u8], Vec<u8>, etc. with the native types mapped to the newly declared structs.
This should enable the Rust programmer to use the usual Rust collection types while still having enough information in the binary to allow the IDL/etc. to define the types for the collections.
To make things easy for the parameter mapping, I'm hoping that the U8Collection that the macro implements would be something similar to:
We need some kind of collection support. One option would be implementing COM
SAFEARRAY
<-> Rust[T]
slice.At least the following things should be possible:
Rust
COM clients
Even if we need to go with the
SAFEARRAY
approach, we don't need to support the fullSAFEARRAY
to begin with. We could even make the assumption that theSAFEARRAY
s can only be used in methods that returnComResult
(or similar) and thus theSAFEARRAY
conversion methods can yieldE_INVALIDARG
in bad cases to report invalid use ofSAFEARRAY
s.The text was updated successfully, but these errors were encountered: