September 04, 2014 Re: writeln() assertion failed in hybrid x64 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Szymon Gatner | https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dmain2.d#L270 well, this sucks. |
September 05, 2014 Re: writeln() assertion failed in hybrid x64 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jorge A. S. | On Thursday, 4 September 2014 at 15:10:22 UTC, Jorge A. S. wrote:
> I'm having an error related to yours: when I call writeln function in a closed stdout I will get a segfault message. Example:
>
> import std.stdio;
>
> void main() {
> stdout.close();
> write("hello\n");
> }
>
> The code above will crash with segfault buf the following code will raise an exception instead:
>
> import std.stdio;
>
> void main() {
> stdout.close();
> stdout.write("hello\n");
> }
>
> In one of the specializations of the write function in the std.stdio (the call site that you showed in your post) no check for closed stdout (when stdout._p is null) is done. I can't say if this is a bug in the write function or the desired behaviour (I'm a novice here).
>
With DMD of git master, the latter code seems to raise Exception (stdio.d(2247): Enforcement failed) instead of segfault.
|
September 05, 2014 Re: writeln() assertion failed in hybrid x64 | ||||
---|---|---|---|---|
| ||||
Posted in reply to hane | On Friday, 5 September 2014 at 07:22:23 UTC, hane wrote:
> On Thursday, 4 September 2014 at 15:10:22 UTC, Jorge A. S. wrote:
>> I'm having an error related to yours: when I call writeln function in a closed stdout I will get a segfault message. Example:
>>
>> import std.stdio;
>>
>> void main() {
>> stdout.close();
>> write("hello\n");
>> }
>>
>> The code above will crash with segfault buf the following code will raise an exception instead:
>>
>> import std.stdio;
>>
>> void main() {
>> stdout.close();
>> stdout.write("hello\n");
>> }
>>
>> In one of the specializations of the write function in the std.stdio (the call site that you showed in your post) no check for closed stdout (when stdout._p is null) is done. I can't say if this is a bug in the write function or the desired behaviour (I'm a novice here).
>>
>
> With DMD of git master, the latter code seems to raise Exception (stdio.d(2247): Enforcement failed) instead of segfault.
Oops, I meant 'former' of course.
|
September 05, 2014 Re: writeln() assertion failed in hybrid x64 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Thursday, 4 September 2014 at 20:57:41 UTC, Kagamin wrote:
> https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dmain2.d#L270 well, this sucks.
Is there a way I can call module c-tors explicitly?
I was under impression that D(dmd) was suppose to work with VisualC++ in x64bit mode.
|
September 05, 2014 Re: writeln() assertion failed in hybrid x64 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Szymon Gatner | It's not a module ctor, this code is executed much earlier. You can write a function, which will initialize standard streams, and call it from the C code before rt_init. |
Copyright © 1999-2021 by the D Language Foundation