Problem with GC - linking C++ & D (with gdc)

dangbinghoo dangbinghoo at gmail.com
Thu Apr 28 01:25:41 UTC 2022


On Tuesday, 26 April 2022 at 13:36:19 UTC, Claude wrote:
> On Tuesday, 26 April 2022 at 12:49:21 UTC, Alain De Vos wrote:
> ---
>
> I also encountered problems while I was trying to use CTFE only 
> functions (using betterC so I don't have to link 
> phobos/D-runtime).
>
> However, if those functions use the GC for instance (like 
> appending a dynamic-array), it will require me to link 
> D-runtime, whereas I only use them at compile-time. So I'm a 
> bit confused... I'll try and get more information and reduce a 
> code sample.

dont't use `new` if you mean using betterC, `new` is based on GC. 
with betterC, you should using `malloc/free`

reference info: 
https://dlang.org/spec/cpp_interface.html#memory-allocation



More information about the Digitalmars-d-learn mailing list