this post was submitted on 25 Sep 2024
379 points (93.0% liked)
Programmer Humor
19813 readers
368 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
They don't. C compilers compile single files produced by the c preprocessor (resolving all
#include
s), they have no concept of multi-file projects. That's a thing for the build system, such as make, and it needs dependency information from the preprocessor to do its job (cpp -M
), and once it has that it has to act correctly on them which is often completely broken because people don't understand make. Like using it recursively, bad idea. In the wild, a random C project at work you'll come across needs a full rebuild to build cleanly. Things have gotten better with things like cmake getting more popular but the whole thing is still brittle. GNU autohell certainly makes nothing better, ever.Everything will always have an ABI because ABI is just API in the target language, whatever that may be. If your program is compiled and can run it uses an ABI.
The core wasm abi is less capable than the C abi: You get scalar values and pointers, that's it. No structs, no nothing, memory layout is completely unspecified. The component model allows compilers to say "so I'm laying out strings like this and structs like that" giving linkers a chance to say "yeah I can generate glue code between you two".
C isn't even close to being viable according to your standards people just have gotten used to the jank.
Rust doesn't have portable dylibs precisely because it isn't a hot mess. Because it's actual work to do it properly. Unlike everyone else. Meanwhile It speaks the local C ABI fluently (they differ by architecture and operating system, btw), which isn't a thing that can be said about many languages that aren't C.
Differently put: What, precisely, do you want to do? Have you any actual use-case for your doubts, or are they spooks?