Using ImportC to augment a big C project with D

Carl Sturtivant sturtivant at gmail.com
Wed Feb 21 14:42:28 UTC 2024


On Wednesday, 21 February 2024 at 12:45:50 UTC, Bastiaan Veelo 
wrote:
> What do you mean by "need"? You can call 
> https://dlang.org/phobos/core_stdc_stdlib.html#.exit from D:

Of course, but does it respect D shutdown?

> Output:
> ```
> onlineapp._sharedStaticDtor_L11_C1
> ```
>
> So it does run module destructors, but not `scope(exit)` 
> statements (which probably makes sense).

So it doesn't respect D shutdown, i.e. what happens when 
returning from main with an error code.

> I would expect `exit()` called from the C source to have 
> similar results.

Why is that?

I just found this.
[Proper way to exit with specific exit 
code?](https://forum.dlang.org/thread/bavfkowjjcijeshrtisl@forum.dlang.org)







More information about the Digitalmars-d-learn mailing list