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() {

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 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

Missing library dependencies compiling app with importC

2024-02-21 Thread ptcute via Digitalmars-d-learn
Greeings! My c to d header wrapper file curl_d.c (just 2 lines): #include #include //seems with or without this doesn't matter Trying A: My main c file :direct_call_c.c: #include #include #include "curl_d.c" {...} dmd -m64 direct_call_c.c curl_d.c curl.lib ... direct_call_c.obj : err