jobserver-rs icon indicating copy to clipboard operation
jobserver-rs copied to clipboard

Would it be safe to alias `c_int` ?

Open RCasatta opened this issue 2 years ago • 3 comments

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?

RCasatta avatar Sep 13 '22 13:09 RCasatta

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.

joshtriplett avatar Aug 10 '23 17:08 joshtriplett

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 avatar Aug 10 '23 23:08 NobodyXu

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.

NobodyXu avatar Aug 11 '23 00:08 NobodyXu