std library hooks

Walter Bright newshound2 at digitalmars.com
Sun Apr 15 16:26:37 PDT 2012


On 4/15/2012 6:12 AM, Artur Skawina wrote:
> Static libraries (*.a) are basically just collections of compiled objects (*.o).

More precisely, a library is (literally) just an associative array. The index is 
a string representing the name of a symbol. The value is an object file that 
defines that symbol.

If you look at dmd's library generation code (libelf.c, libomf.c, libmach.c) you 
can see this in operation.

i.e. a library is nothing more than:

    doto[symbolname] library;

that's it. All of it. Nothing else.

Note that a library doesn't even know what a symbol is. It's just a string. No 
type information, no storage class, no scopes, no nothing. Just a string of bytes.


More information about the Digitalmars-d mailing list