I'm working on some Qt bindings in D, and because I'm going about the business of doing weird things to bind to C++, I'm starting to do strange things with DUB.

The first strange thing is generating D source files and building those. There is an issue blocking this, which has been discussed here before.

The second strange thing I'm trying to do is to build .cpp source files into object code, and then link that into my library. This is because I have found there are some things I simply cannot do in D. The big one is writing a function for allowing for some dynamic_cast behaviour. I have found ways to avoid generating .cpp files in the past, but this one doesn't seem possible otherwise.

How would I go about building a library with DUB which has C++ code linked into it? Should I do something like run an external script which in turn invokes gcc or something?