Comment

Comment by cryptonector

How about dynamic linking? Yeah, ok, that's hard. You might have to write an RTLD to link into the executable to find and load cosmo DLLs. Maybe not that hard... You could borrow BSD ld.so.1 code, I suppose.

Ah, that brings me to something else that someone like jart might want to take on:

# bringing static linking for C into the 21st century

What's wrong with static linking in C? Well, it's still stuck with 1970s semantics, while dynamic linking has much nicer semantics. Specifically:

  - static linking flattens the dependency
    tree, which causes

  - symbol collision issues

  - also, there's no RPATH equiv. for static
    linking
My thinking is to:

  - write dependency metadata (-lfoo, rpath,
    -L/...) into a "hidden" .o that has just
    this metadata encoded in it

  - make the static linker look for that
    metadata in dependencies and resolve
    conflicts the same way as in dynamic
    linking

  - for each link-edit, including the final
    link-edit of the executable, require
    only that direct -lfoo dependencies be
    listed
Well, anyways, it's a lot to ask :(

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton