www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14327] New: Unhandled exception from writeln() in C++/D


          Issue ID: 14327
           Summary: Unhandled exception from writeln() in C++/D
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: major
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: szymon.gatner gmail.com

With this C++ application:

extern "C" int rt_init(); // prototypes of standard D runtime functions
extern "C" void rt_term();

extern "C" void dfunc();

int main()
  auto dinit = rt_init(); // returns 1
  dfunc(); // causes unhandled exception

and linking to this D library:

module lib;

extern(C) void dfunc()
  import std.stdio;
  writeln("Hello from D!");

int main()
  return 0;

call to dfunc() on C++ side causes Unhandled exception in stdio.d line 2917:

        // Specialization for strings - a very frequent case
        auto w = .trustedStdout.lockingTextWriter();

initial report on D forums [1] leads potential issue with stdio module static
initialization failure.

Using Visual Studio 2012, x64 app, Win 7 x64

http://forum.dlang.org/thread/hsglkscatlniiuacpkhe forum.dlang.org#post-mailman.397.1409844359.5783.digitalmars-d-learn:40puremagic.com

Mar 24 2015