windows rt for linux,Rust/WinRT - Rust for the Windows Runtime

badge.svg?event=push

The Rust/WinRT language projection

Rust/WinRT follows in the tradition established by C++/WinRT of building language projections for the Windows Runtime using standard languages and compilers, providing a natural and idiomatic way for Rust developers to call Windows APIs. Rust/WinRT lets you call any WinRT API past, present, and future using code generated on the fly directly from the metadata describing the API and right into your Rust package where you can call them as if they were just another Rust module.

The Windows Runtime is based on Component Object Model (COM) APIs under the hood and is designed to be accessed through language projections like C++/WinRT and Rust/WinRT. Those language projections take the metadata describing various APIs and provide natural bindings for the target programming language. As you can imagine, this allows developers to more easily build apps and components for Windows using their desired language. You can then use those Windows APIs to build desktop apps, store apps, or something more unique like a component, NT service, or device driver.

Getting started

Start by adding the following to your Cargo.toml file:

[dependencies]

winrt = { git = "https://github.com/microsoft/winrt-rs" }

This will allow Cargo to download, build, and cache the Rust/WinRT support as a package directly from GitHub.

use winrt::*;

// Now use the `import` macro to import the desired winmd files and types:

import!(

dependencies

os

types

windows::data::xml::dom::*

windows::foundation::*

windows::ui::*

);

// Finally, make use of any WinRT APIs as needed. For example, here is

// an example of using the `XmlDocument` class to parse an XML document:

fn main() -> Result {

use windows::data::xml::dom::*;

let doc = XmlDocument::new()?;

doc.load_xml("hello world")?;

let root = doc.document_element()?;

assert!(root.node_name()? == "html");

assert!(root.inner_text()? == "hello world");

Ok(())

}

For a more complete example, take a look at Robert Mikhayelyan's Minesweeper.

Cross-platform support

While support for platforms other than Windows (i.e., *-windows-msvc targets) is possible and on the long-term roadmap, support outside of Windows is not an immediate goal. If you are interested in support outside of Windows, please let us know.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在Yocto中,生成文件的过程是由BitBake工具完成的。BitBake是一个构建工具,用于构建Yocto项目,它可以生成各种文件,包括配置文件、日志文件、临时文件、构建输出等等。 在您提到的情况下,生成`aarch64-poky-linux.json`文件的过程如下: 1. 首先,BitBake通过查找`recipes-devtools/rust/rust-cross_%.bbappend`文件来确定如何构建交叉编译工具链。在该文件中,会有一些变量和指令,用于指导BitBake如何构建交叉编译工具链。 2. 根据`do_configure`指令,BitBake会运行`rust/configure`脚本来配置Rust编译器。在这个过程中,BitBake会设置一些编译器选项、环境变量等等。 3. 接下来,BitBake会运行`do_compile`指令来编译Rust编译器。在这个过程中,BitBake会生成一些中间文件、目标文件和库文件。这些文件会被放置在`build/tmp/work/x86_64-linux/rust-cross-armv8a-glibc/1.59.0-r0/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/aarch64-poky-linux/lib/`目录下。 4. 最后,BitBake会运行`do_install`指令来安装Rust编译器。在这个过程中,BitBake会将编译好的文件复制到`build/tmp/work/x86_64-linux/rust-cross-armv8a-glibc/1.59.0-r0/sysroot/usr/lib/rustlib/aarch64-poky-linux/lib/`目录下。同时,BitBake也会生成`aarch64-poky-linux.json`文件,并将其放置在`build/tmp/work/x86_64-linux/rust-cross-armv8a-glibc/1.59.0-r0/targets/`目录下。 总的来说,生成`aarch64-poky-linux.json`文件是由BitBake工具在编译Rust交叉编译器的过程中生成的。具体的生成过程是由`recipes-devtools/rust/rust-cross_%.bbappend`文件和`do_configure`、`do_compile`、`do_install`指令控制的。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值