What is the compilation model of D?

Jacob Carlborg doob at me.com
Wed Jul 25 00:05:15 PDT 2012


On 2012-07-25 04:00, Nick Sabalausky wrote:

> But that's just the DMD compiler itself. Instead of using DMD
> directly, there's a better modern trick that's generally preferred:
> RDMD.
>
> If you use rdmd to compile (instead of dmd), you *just* give it
> your *one* main source file (typically the one with your "main()"
> function). This file must be the *last* parameter passed to rdmd:
>
> $rdmd --build-only (any other flags) main.d
>
> Then, RDMD will figure out *all* of the source files needed (using
> the full compiler's frontend, so it never gets fooled into missing
> anything), and if any of them have been changed, it will automatically
> pass them *all* into DMD for you. This way, you don't have to
> manually keep track of all your files and pass them all into
> DMD youself. Just give RDMD your main file and that's it, you're golden.

RDMD is mostly useful for executables, not so much for libraries. For 
libraries you would need to pass _all_ of your project files directly to 
DMD (or find some other tool). It's perfectly fine to have a library 
which consists of two files with no interaction between them. Neither 
RDMD or the compiler can track that.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list