by dkhenry · 10y ago · 0 comments
http://blog.dkhenry.com/2016/02/17/deciding-to-rewrite-getad...
I think the way to tackle a rust glibc rewrite:
Step 0 - write a code generator that just generates rust code that call the C versions of glibc symbols ( based off of the publicly exposed API in the library files). Get test suite to run
Step 1 - Make that rust code generate a 100% drop-in replacement fro the C symbols (maybe this requires injecting version numbers)
Step 2 - write the `getaddrinfo` replacement in Rust
???
Step 4 - have all of glibc ported
EDIT: Does anyone know of any gotchas with linking that would cause this to happen? Seriously considering taking a day off to do step O.
For step 1, you'd need to carefully look at glibc's ABI, which is even more complicated than its API due to backward compatibility and symbol versioning.
I get it, the idea is to replace this core low-level library with something you could maybe run C programs on top of. But damn, that is a crappy interface (which is specified by both an ISO standard and an IETF RFC so I must be an idiot, right?).