Is there a way to change the size of wchar_t in a Rust static library?

211 Views Asked by At

I'm trying to use Rust in an existing embedded C project on a M0+ micro-controller. I am using the Keil IDE to compile the code.

I can get a lib.a static library to generate, but when I try to compile it into my project I get an error saying that it can't link because

... wchart-16 clashes with wchart-32.

Because this is an existing project, I cannot change the size of wchar_t that is being used.

Is there a way to change the size of a wchar_t to use 16 bits in the compiled Rust library?

Files

lib.rs

#![no_std]

extern crate panic_halt; 

#[no_mangle]
pub extern "C" fn rust_function() {

}

Cargo.toml

[package]
# package info is here

[dependencies]
panic-halt = "0.2.0"

[lib]
name = "app_interface"
crate-type = ["staticlib"] # Creates static lib

cargo\config

[target.thumbv7m-none-eabi]

[target.'cfg(all(target_arch = "arm", target_os = "none"))']

rustflags = [
  "-C", "link-arg=-Tlink.x",
]

[build]
target = "thumbv6m-none-eabi"    
0

There are 0 best solutions below