Adding Rust Language Support for RT-Thread #10910
ToolsCI / Tools (push) Has been cancelled
RT-Thread BSP Static Build Check / 🔍 Summary of Git Diff Changes (push) Has been cancelled
RT-Thread BSP Static Build Check / ${{ matrix.legs.RTT_BSP }} (push) Has been cancelled
RT-Thread BSP Static Build Check / collect-artifacts (push) Has been cancelled
pkgs_test / change (push) Has been cancelled
utest_auto_run / A9 :components/dfs.cfg (push) Has been cancelled
utest_auto_run / A9 :components/lwip.cfg (push) Has been cancelled
utest_auto_run / A9 :components/netdev.cfg (push) Has been cancelled
utest_auto_run / A9 :components/sal.cfg (push) Has been cancelled
utest_auto_run / A9 :cpp11/cpp11.cfg (push) Has been cancelled
utest_auto_run / AARCH64-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / A9-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / RISCV-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / XUANTIE-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / AARCH64 :default.cfg (push) Has been cancelled
utest_auto_run / AARCH64-smp :default.cfg (push) Has been cancelled
utest_auto_run / A9 :default.cfg (push) Has been cancelled
utest_auto_run / A9-smp :default.cfg (push) Has been cancelled
utest_auto_run / RISCV :default.cfg (push) Has been cancelled
utest_auto_run / RISCV-smp :default.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/atomic_c11.cfg (push) Has been cancelled
utest_auto_run / RISCV :kernel/atomic_c11.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/ipc.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/kernel_basic.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/mem.cfg (push) Has been cancelled
Weekly CI Scheduler / Trigger and Monitor CIs (push) Has been cancelled
Weekly CI Scheduler / Create Discussion Report (push) Has been cancelled

This commit is contained in:
zhang san
2025-12-08 18:34:25 +08:00
committed by GitHub
parent cd1d47b87c
commit 69980f8b9d
88 changed files with 6734 additions and 4 deletions
@@ -0,0 +1,12 @@
[package]
name = "em_loadlib"
version = "0.1.0"
edition = "2021"
[lib]
name = "em_loadlib"
crate-type = ["staticlib"]
[dependencies]
rt-rust = { path = "../../../core" }
rt_macros = { path = "../../../rt_macros" }
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2006-2025, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author notes
* 2025-10-10 foxglove load library example
* 2025-10-29 foxglove Updated to demonstrate new modular macro interface
*/
#![no_std]
extern crate alloc;
use rt_macros::msh_cmd_export;
use rt_rust::println;
use rt_rust::get_libfn;
use core::ffi::{c_int, c_char};
use rt_rust::param::Param;
#[msh_cmd_export(name = "rust_dl_demo", desc = "Rust dynamic library demo")]
fn main(_param: Param) {
println!("\n=== Dynamic Library Demo ===");
get_libfn!("/hello.mo", "main", my_hello, ());
my_hello();
get_libfn!("/libmylib.mo", "rust_mylib_add", my_add, c_int, a: c_int, b: c_int);
let s = my_add(15, 20);
println!("my_add(15, 20) = {}", s);
get_libfn!("/libmylib.mo", "rust_mylib_println", my_println, (), s: *const c_char);
my_println(b"rustlib: Hello World\0".as_ptr() as *const c_char);
}