On Mon, Mar 28, 2011 at 12:34 PM, maarten van damme <[email protected]> wrote: > Thanks to everyone, I got it to compile :D > > Still don't get the point of a lib file. I'm used to program java and there > you can compile to a jar-libary, a lib in d is obviously not the same. >
In a machine-compiled language, a library just contains straight binary, and you need a header or an import file (di) to tell the compiler exactly what code is in that library. This is because unlike Java, where type information is preserved in bytecode, machine-compiled code loses a lot of type information during the transition from code to binary. For example, if I have void add(int a, uint b) and I compile it, I can no longer tell you that a and b have different types. At least, this is how I understand it.
