2002.05.16 ~06 QVM-bytecode libraries I was pondering the separation of the libc files into a separate directory. This would mean altering the compilation scripts (bash scripts) to deliberately reach into the libc directory, compile each file to assembly, then explicitly link the resulting files. Then I wondered how I could cut down such tediousness (i.e. editing a couple files to list every single file affected). One method that sprung to mind was using ar(1), creating .a files for each distinct library packages, e.g. libvorbis.a, libc.a, libz.a, etc. These .a files contain distinct .o files, each derived from an associated .c file (for the most part). The .a file can also contain a symbol table, an association of symbols to locations within the .a and .o files. So for each library package, an associated .a file is created. Then if some symbol "funcfoo" was needed, the linker (q3ld?) can look through some existing .a file (e.g. "libmystuff.a"), find "funcfoo" is defined in "foo_bie.o", extract "foo_bie.o", and link it into the resulting qvm, taking into account adjusted offsets. The end result is a simplification in adding new external sources. I would no longer need to edit the compile scripts to list every .c file to look at, every .asm file to link. Instead, I would need only to compile each "library package" separately into .a files, then leave the tasks of searching and resolving to the linker. To do the adjusted offsets (of symbols) would mean needing some kind of structured format for the .o files to keep track of "normal" offsets. Using an already existing format, such as a.out or COFF or ELF, would allow using standard ar(1) and ranlib(1) to create the .a files (and its symbol table). Doing so would also save me the trouble of trying to come up with an appropriate format then re-extending it repeatedly in the future :) This could mean utilizing GNU BFD in some form. At this point, I realized something chilling. The .a files are self-contained; they don't "depend" upon outside files for its content. In other words, it would be very much "drop-in". Binary drop-in. Libraries could be distributed without source.