How to build libc in dylib?

#1

Is it possible to build libc in dylib format? Right now it would be built into rlib by default.

I tried to add this in libc’s Cargo.toml:

[lib]

crate-type = [“dylib”]

But get these errors:

error: #[panic_handler] function required, but not found

error: language item required, but not found: eh_personality

error: aborting due to 2 previous errors

Is the libc designed not to support “dylib” mode? Or is there more change need to be made to make it work?

Thanks,

Baoshan

#2

Rust’s libc crate is more like C’s .h file. It doesn’t do anything, it just tells the compiler that certain functions exist elsewhere.

1 Like