https://issues.dlang.org/show_bug.cgi?id=22181

          Issue ID: 22181
           Summary: No stack trace if usage of SimpleDllMain in static
                    linked DLL
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: [email protected]
          Reporter: [email protected]

It seems that SimpleDllMain plays not well with static linked DLLs.
The trace is empty.

Tested under Windows 10 but same problem on Windows 7.
Doesn't matter if 32 or 64 bit.

This example would not need SimpleDllMain but other complex functions may
require it.

// dmd -g -version=lib -L/IMPLIB -of=common.dll
version (lib)
{
    import core.sys.windows.dll;
    mixin SimpleDllMain;

    export int test()
    {
        return 123;
    }
}
else
{
    import std.stdio;

    pragma(lib, "common.lib");
    extern int test();

    void main()
    {
        assert(test() == 123);

        try
        {
            throw new Exception("test");
        }
        catch (Throwable e)
        {
            const(char)[] lines;
            foreach (n; e.info)
                lines ~= n;

            assert(lines.length > 0);
        }
    }
}

--

Reply via email to