Re: Using ImportC to augment a big C project with D

2024-02-21 Thread Carl Sturtivant via Digitalmars-d-learn
On Tuesday, 20 February 2024 at 18:33:42 UTC, Carl Sturtivant wrote: 1. When the resulting executable runs it will have D call C which in turn calls D. In that last D (the D files replacing some C files), if I throw an exception and don't catch it in the D files that replace some C files, will

Re: Using ImportC to augment a big C project with D

2024-02-21 Thread Carl Sturtivant via Digitalmars-d-learn
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 dest

Re: Using ImportC to augment a big C project with D

2024-02-21 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 20 February 2024 at 18:33:42 UTC, Carl Sturtivant wrote: 2. The C source calls exit() from C's stdlib, and D needs to terminate properly. What do you mean by "need"? You can call https://dlang.org/phobos/core_stdc_stdlib.html#.exit from D: ```d import std.stdio; void main() {

Using ImportC to augment a big C project with D

2024-02-20 Thread Carl Sturtivant via Digitalmars-d-learn
I just saw the announcement that macros with parameters are now translated into D by ImportC. Incredible! Congratulations to all involved. As an occasional D user, I have long wanted a fast route to using D with an existing large C project (100K lines approximately). I want to replace the C