2 ms·
Part of the answer is that C++ wants to interrogate your system or build root to understand its capabilities. "Call this function if available" or "Access this
by ridiculous_fish 4y ago
Part of the answer is that C++ wants to interrogate your system or build root to understand its capabilities. "Call this function if available" or "Access this variable if it exists" are more common in C++ projects, compared to the other languages you listed.
Rust tries to avoid that by hard-coding availability into the libraries themselves, but the result is less reliable. For example I cannot use `libc::mkostemp` on macOS because Rust has (incorrectly) hard-coded that it is not available on that platform.
CMake is able to detect it, but we pay a cost in build system complexity. I wish instead this detection could be done at runtime.
- vlovich123 4y agoRust can do that through build.rs, no?
- ridiculous_fish 4y agoProbably. I would like to see how it's done, build.rs does seem like the most sensible place. Debugging build.rs is painful.