-unittest doesn't work when linking against shared libraries

Timothee Cour thelastmammoth at gmail.com
Sat Dec 9 00:32:36 UTC 2017


>> They are on LDC; would be interesting to see whether the problem occurs there as well (I'm having issues with my Mac right now, so can't check myself until later).

just updated bug report: same issue with ldc!

>> But yes, you can't really expect any sort of runtime infrastructure to work with shared libraries on DMD/macOS right now.

a lot of things work with shared libraries on OSX, it would be great
if this worked too. It's not because shared libraries are not 100%
fully officially supported that we should ignore this issue. Certain
use cases are impossible without using shared libraries.



On Fri, Dec 8, 2017 at 3:55 PM, Jonathan M Davis via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> 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