The Pollen Programming Language/Operating system development in modern languages
Operating system development in modern languages and static libraries
[edit | edit source]It is difficult, in my opinion, to write C programs that include multiple static libraries in them in modern programming languages. Modern programming languages usually include a runtime library. Rust, D and Ada all include a runtime.
The Rust runtime is very minimal but it is required because it includes definitions for basic integer types, vectors and others. The no_std macro leaves only operating system independent code that do not depend on allocations.
That is analogous to betterC in D. betterC removes the runtime library entirely. There is no GC, TypeInfo, or allocations.
- Rust does not require runtime initialization when Rust libraries are linked statically.
- Ada requires a runtime initialization by calling adainit and adafinal.
- D also requires runtime initialization when not in betterC mode for initializing the GC and other globals as well as calling some operating system functions for setting state such as pthreads.
In previous versions, cargo init created libraries by default instead of binaries. Those modules contained Rust-only code which were linked to static or dynamic libraries written in C, including the C standard library or any operating system library. Similarly, Ada libraries contain only Ada code. In fact, .a libraries can be linked just like .o object files, which in turn map to a source file written in a specific language.