Include standard library function definitions in static library

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Include standard library function definitions in static library

483 次查看
tarun1
Contributor I

Hi, I am creating a static library in MCUXpresso IDE. I am using redlib for importing `stdlib.h` in my code. It successfully builds a static library. However, some of the standard library functions such as "malloc", "exit" are undefined in the static library. I verified that using `nm` command. 

The problem is that I plan to use this static library in rust using ffi. And when I try to load the static library in my rust code I get error `rust-lld: error: undefined symbol: malloc`. How can I include these definitions in my static library?

 

0 项奖励
回复
1 回复

454 次查看
ErichStyger
Senior Contributor V
these functions like malloc() are part of the C/C++ standard library. You will have to either combine your library with the standard library or link your Rust application with it too.
0 项奖励
回复