We have dlopen and we can list exported symbols, but we have no information about a function's arguments, ABI and calling convention, so it's pretty much impossible to turn UNIX into a fully late-bound and interactive REPL. Same issue with syscalls.
The only way is starting from scratch, with a novel approach and programming model.
Re:—-libcurl
by supriyo-biswas on Monday January 29, 2024 @10:04AM
(#39177025)
Why can’t you add additional data about the data types of parameters in a separate ELF section? It would be only used by programs that look for it like a specially designed shell.
The calling convention can be assumed to be the same as used by the OS/arch combination.
You could, but you then have to recompile the world with this new information stored as a ELF header or something, and good luck if the library is not written in C (so it has its own conventions, ABI, memory model and binary format)
I'm talking about the status quo today, not how you can improve in a perfect world where everybody adopts a better way of doing things.
Implementing an half-baked Smalltalk layer on top of UNIX will not turn UNIX into a Smalltalk environment.
Re:—-libcurl
by overboard2 on Monday January 29, 2024 @09:57AM
(#39176944)
Or you could add some more sections to object files. Just make clang and/or gcc export function signatures, structs, enums, and typedefs
Re:—-libcurl
by actionfromafar on Monday January 29, 2024 @10:59AM
(#39177800)
I wonder if one of the existing interpreted languages (python/javascript/ruby/whatever) could maintain a patch for llmv/gcc which did exactly that and in the process make the most incredible seamless integration ever between itself and C (and also C++ now with its ABI stabilizing!)
PowerShell?
With CLR assemblies, you get rich embedded metadata including UDTs like structs and unions, and architecture-portable JIT-compiled bytecode to boot - both sufficient to map the entirety of C data and execution model.
Too bad we're stuck with UNIX/POSIX model - you could even take this idea of exported data structures and have the terminal represent data in the preferred users format instead of having tools like jq.