https://issues.dlang.org/show_bug.cgi?id=16440
--- Comment #2 from ag0ae...@gmail.com --- (In reply to Andrej Mitrovic from comment #1) > The problem is the compiler allows -c and -main. It will generate the D main > function in a separate module but later when you try to link via `dmd > test.obj` you won't be linking with this module. I think the module from -main is there when linking, but the one actually given on the command line is discarded/ignored/overwritten. Otherwise, linking should fail because of no main. But linking succeeds and produces a program that doesn't do anything. [...] > In the meantime allowing -c and -main in the same invocation should be > disallowed. When -of is not given, -c and -main work acceptably together. dmd generates a __main.o for the main module. Only with -of do things get weird. I don't see how there would be some fundamental problem. dmd happily compiles multiple source files to one object file. So it should be able to add an empty main function to an object file without breaking the other code. --