-unittest doesn't work when linking against shared libraries

Jonathan M Davis newsgroup.d at jmdavisprog.com
Fri Dec 8 23:55:53 UTC 2017


On Friday, December 08, 2017 10:45:29 Steven Schveighoffer via Digitalmars-d 
wrote:
> On 12/7/17 9:15 PM, Jonathan M Davis wrote:
> > On Thursday, December 07, 2017 14:34:01 Timothee Cour via Digitalmars-d
> >
> > wrote:
> >> I have a simple test case to reproduce in
> >> https://issues.dlang.org/show_bug.cgi?id=18046
> >> this seems like a serious bug; what would be a workaround when dealing
> >> with shared libraries?
> >
> > If you're trying to unit test a shared library, I'd suggest just turning
> > it into a static library for the tests. Alternatively, you can write
> > the unit tests in an application that links against the shared library,
> > but that means separating the tests from the code, which isn't ideal.
>
> I think you misunderstand. If there is a shared library being linked
> against, then the tests in your application don't run (see the bug
> report). Definitely a serious bug. I would be interested how they work
> on Linux with shared libraries, maybe it's a mac thing.

Ah. I did misunderstand then. Yeah, that would be a big problem, and I don't
know how you'd work around that except not using shared libraries for the
unit test build, which may or may not be possible.

- Jonathan M Davis



More information about the Digitalmars-d mailing list