我想用一个ARM工具链用c编写一个简单的测试程序。
我的Makefile如下:
CC=/project_path/arm-linux-uclibcgnueabi/bin/gcc
# the compiler: gcc for C program, define as g++ for C++
# compiler flags:
# -g adds debugging information to the executable file
# -Wall turns on most, but not all, compiler warnings
CFLAGS = -g -Wall
#
我用Rust编写了一个库,该库使用libc crate提供的sprintf函数进行C格式化。一切都可以在macOS和Linux上运行,但它不能在Windows上编译,因为sprintf函数不存在。
extern crate libc;
use libc::{c_char, c_double, sprintf};
let c_resfmt: CString =
CString::new(c_resfmt).expect("Couldn't convert to c_resfmt to CString ");
let result_buffer: *mut c_ch