rust-lang / jobserver-rs

Apache License 2.0
69 stars 40 forks source link

Would it be safe to alias `c_int` ? #44

Open RCasatta opened 2 years ago

RCasatta commented 2 years ago

related to https://github.com/rust-lang/cc-rs/issues/721

I was wondering if it would be safe to alias c_int along the lines of what is done here

https://github.com/tcharding/rust-bitcoinconsensus/blob/9b3496a5c827e99cf10debe2c36f7b20fd622cc4/src/types.rs

This would allow this lib to not depend on libc on unix?

joshtriplett commented 1 year ago

c_int is not the only thing jobserver-rs uses libc for; it's also invoking various functions via libc. That would be a lot harder to work around.

If it saved substantial build time for many crates, it might be worth working around, but it's also not obvious how to do so.

NobodyXu commented 1 year ago

it's also invoking various functions via libc. That would be a lot harder to work around.

Yes, you would have to manually define syscalls using assembly, which really cannot be "vendored".

Though it's possible for cc to vendor jobserver since it only uses a subset of its API and already vendored windows-sys APIs and have function for making anonymous pipe on Unix and Windows.

NobodyXu commented 1 year ago

If it saved substantial build time for many crates, it might be worth working around, but it's also not obvious how to do so.

If libc can bump its MSRV, then its build.rs could be reduced in size and faster to compile.