On 9/17/11, Rainer Schuetze <r.sagita...@gmx.de> wrote:
> I think the main issue here is that a module that is compiled to a
> library, is split into a lot of small "object files" (one for each
> function or global variable) before being combined to the library. This
> allows the linker to just take the actually referenced parts and leave
> out anything that is never called.

Well maybe DMD could tell Mr. Optlink to not do that if I pass
-unittest and -lib. :)

> The unit tests are only referenced from the module info, so it might
> work if you have a reference to it in your main executable.

How do I reference this module info?

> Another workaround would be to build the library in two steps, compiling
> to normal object files first, then binding these to a library (shameless
> ad: "separate compile and link" in Visual D):
>
> dmd -unittest -c -od. test1.d test2.d
> dmd -lib -oftest.lib test1.obj test1.obj

That works as long as in main I reference a function from the library
(I guess that's where that comment in unittest.d came from, and the
complicated makefile). I'm so-so for this solution.

Reply via email to