Rantanen / intercom

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

Try to get rid of com_impl #160

Closed Rantanen closed 4 years ago

Rantanen commented 4 years ago

Getting rid of #[com_impl] attribute would...

Currently the VTable generation is tied to the com_impl. There's a chance that can be removed by generating the type conversion functions as generic functions:

extern "system" fn __IFoo_Automation_do_stuff<TStruct>(vtbl: *const *const VTable, params...)
where TStruct: ComInterface<IFoo>
{
    let instance_ptr = vtbl - <TStruct as ComInterface<IFoo>>::offset();
    let instance : &TStruct = &*vtbl;
    ...
}