Am 11.12.2013 16:32, schrieb Jacob Carlborg:

On Wed, 11 Dec 2013 08:36:29 GMT, Sönke Ludwig wrote:

Sounds like the compiler should be smarter here. Wasn't there some issue that DMD always emits all symbols in Posix systems, which is supposed to be fixed by a proper "export" definition?

I don't think so. I'm pretty sure it's only for shared libraries.

It's planned to make that the default behavior and the first step was already taken in 0.9.20 (caching the build result of each package). It will be the next addition to the build system, but I don't know when exactly I can get around to do it. See also https://github.com/rejectedsoftware/dub/wiki/Separate-compilation-and-caching-of-dependencies.

Ok, I see.

A workaround is to define two configurations in each dependency, the first "library" one just outputs a "library" target as normal, and a second "import" configuration defines the necessary flags for importing that library (consisting of only import folders + the library import flags).

Then each dependency needs to be built once using "dub build (dependency)" and the main project should put a "subConfigurations": {"(dependency)": "import"} entry for each such dependency to use the pre-compiled version.

Well, hopefully this workaround won't be necessary for long.

I'm not sure I understand how this workaround i supposed to work.

I've prepared a minimal example:
https://gist.github.com/s-ludwig/7916080

(replace "-" by "/" for the file names)

Assuming that both packages are in DUBs search path, "dub build mylib"
followed by "dub build myapp" should do the trick.