www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22181] New: No stack trace if usage of SimpleDllMain in


          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 puremagic.com
          Reporter: frame86 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;
    import std.stdio;

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

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

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

            assert(lines.length > 0);

Aug 05 2021