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
Getting back to authoring (#1094) and metadata generation as originally described in #81 I'd like to support a define macro that would take the place of using MIDL and instead let you define your metadata directly in Rust as follows:
fnmain(){define!{modMicrosoft{modWindows{structStructType{ x:i32, y:i32}
interface IInterfaceType{fnMethod(&self) -> StructType;}
class ClassType:IInterfaceType;}}}}
The define macro would typically be called by a build script to generate the component or project's .winmd file to OUT_DIR/project.winmd and a corresponding set of Rust bindings for the implementation to use to OUT_DIR/project.rs. The project can then use that along with the implement macro to provide the implementation.
MIDL 3.0 is pretty simple, well documented and is rather powerful. Besides, it is used in C++/WinRT so it could also be reused when rewriting components in Rust. Do you think it would make sense to support both ways of defining runtime classes (so also in an .idl file)?
MIDL also has a lot of problems. Of course, nothing prevents you from using MIDL if you prefer. Fundamentally, the winmd format is the canonical representation for metadata. How you get to that is up to you. I'm just working on a way to do it organically in Rust so that MIDL would not be required, but first I'm working out a few minor issues to make sure that developers can start using MIDL in the short term. Basically, the same issues you ran into in your sample project and just making sure it is streamlined.
Thanks, Kenny for putting this together and super helpful to provide a validated short-term solution. For MIDL define, personally I also don't mind defining it, it can particularly serve as a document purpose that can share with the team who will consume it, we can add notes/comments on it. But if we define in Rust macro, it's hard to share it with another team, I think. But sure we can choose the option!
Activity
kennykerr commentedon Mar 11, 2022
Getting back to authoring (#1094) and metadata generation as originally described in #81 I'd like to support a
definemacro that would take the place of using MIDL and instead let you define your metadata directly in Rust as follows:The
definemacro would typically be called by a build script to generate the component or project's .winmdfile toOUT_DIR/project.winmdand a corresponding set of Rust bindings for the implementation to use toOUT_DIR/project.rs. The project can then use that along with theimplementmacro to provide the implementation.Alovchin91 commentedon Mar 14, 2022
MIDL 3.0 is pretty simple, well documented and is rather powerful. Besides, it is used in C++/WinRT so it could also be reused when rewriting components in Rust. Do you think it would make sense to support both ways of defining runtime classes (so also in an .idl file)?
kennykerr commentedon Mar 14, 2022
MIDL also has a lot of problems. Of course, nothing prevents you from using MIDL if you prefer. Fundamentally, the winmd format is the canonical representation for metadata. How you get to that is up to you. I'm just working on a way to do it organically in Rust so that MIDL would not be required, but first I'm working out a few minor issues to make sure that developers can start using MIDL in the short term. Basically, the same issues you ran into in your sample project and just making sure it is streamlined.
huiminyan2017 commentedon Mar 16, 2022
Thanks, Kenny for putting this together and super helpful to provide a validated short-term solution. For MIDL define, personally I also don't mind defining it, it can particularly serve as a document purpose that can share with the team who will consume it, we can add notes/comments on it. But if we define in Rust macro, it's hard to share it with another team, I think. But sure we can choose the option!
kennykerr commentedon Aug 8, 2024
Sorry I've been working on other things but am starting to get back into this.