[Issue 22181] New: No stack trace if usage of SimpleDllMain in static linked DLL

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 5 15:08:50 UTC 2021


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: nobody at puremagic.com
          Reporter: frame86 at live.com

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);
        }
    }
}

--


More information about the Digitalmars-d-bugs mailing list