On Mon, 18 Mar 2013 06:39:22 GMT, Sönke Ludwig wrote:

On Sun, 17 Mar 2013 21:01:15 GMT, Robert wrote:

My thinking was if it is a source library, dub should not provide the main-containing file of vibe to the compiler if the application provides its own, but it should do that if the application does not provide its own main. But you are right, if we simply build static/dynamic libraries and use them, the linker takes care of that automatically.

I think this is a misunderstanding of what we both thought what a "main file" is (containing main() vs. being the root of the dependency hierarchy). So in particular the difficult problem is not to know if an application has a "main file", but if that file actually contains main() or not.

You cannot rely on a library having a "main file" or having a file containing "main()". It's possible and a perfectly valid use case to have a library containing only two files that don't import each other. Doesn't Dub just builds everything in the source directory? Actually, what Dub should do is pass all files in the source directory to Rdmd (or similar) to get all dependencies of all files, then compile all those files. Of course, in my opinion, that should be handled by a proper build tool and not the package manager.