Rantanen / intercom

Object based cross-language FFI for Rust
MIT License
63 stars 7 forks source link

Implement parameter reordering #173

Open Rantanen opened 4 years ago

Rantanen commented 4 years ago

In many real world COM APIs the out parameters aren't only at the end of the parameter list. In the past this meant these APIs would need to be modeled with *mut Ptrs instead of being able to use Intercom's -> ComResult<(...)> return values.

This PR allows using -> ComResult<...> while manually specifying the parameter order for the COM method. This is done with the #[com_signature(..)] attribute on the method:

#[com_interface]
trait IFoo
{
    #[com_signature(a, b, OUT[0], c, OUT[1])]
    fn method(&self, a: u32, b: u32, c: u32) -> ComResult<(u32, u32)>;
}