Skip to content

Conversation

@kennykerr
Copy link
Collaborator

Although windows-rs harmonizes the differences between Win32 and WinRT types, they are encoded somewhat differently in .winmd files and have different type system constraints. In order to simplify the syntax of .rdl files, they will now require a file-level attribute to indicate whether to interpret the file as containing Win32 or WinRT types.

You can use either #![win32] or #![winrt] at the top of the file. For example, this .rdl file defines the Test.Type struct as a WinRT types:

#![winrt]

mod Test {
    struct Type {
        field: i32,
    }
}

You can then use riddle to generate a .winmd and the struct will be encoded as a WinRT type or you can use riddle to generate Rust bindings and again the Rust bindings will use WinRT type semantics.

When generating .rdl files, riddle requires the TYPE configuration value set to either win32 or winrt and it will generate a .rdl file containing only types from the applicable type system.

@kennykerr kennykerr changed the title Riddle dialect Riddle dialects Jul 25, 2023
@kennykerr kennykerr merged commit a20dbba into master Jul 25, 2023
@kennykerr kennykerr deleted the riddle branch July 25, 2023 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants