close program by code

FreeSlave via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 26 07:43:50 PDT 2014


On Thursday, 26 June 2014 at 11:07:37 UTC, Rene Zwanenburg wrote:
> On Thursday, 26 June 2014 at 10:40:00 UTC, John Colvin wrote:
>> On Thursday, 26 June 2014 at 09:58:50 UTC, FreeSlave wrote:
>>> On Thursday, 26 June 2014 at 09:05:23 UTC, pgtkda wrote:
>>>> How can i close my application by code?
>>>
>>> Do you mean exit status? Just call exit function from C 
>>> library.
>>>
>>> import std.c.stdlib;
>>>
>>> void main()
>>> {
>>>   exit(0);
>>> }
>>
>> Will destructors and/or scope statements be executed if you 
>> exit this way?
>
> They won't. Same for module destructors.

Module destructors are called. At least in DMD v2.065. I believe 
d runtime automatically register this with atexit function.



More information about the Digitalmars-d-learn mailing list