Include standard library function definitions in static library

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Include standard library function definitions in static library

662 Views
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 Kudos
Reply
1 Reply

633 Views
ErichStyger
Specialist I
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 Kudos
Reply