Re: Memory leak issue between extern (c) and D function

2023-04-14 Thread backtrack via Digitalmars-d-learn
On Friday, 14 April 2023 at 11:15:59 UTC, Guillaume Piolat wrote: On Friday, 14 April 2023 at 04:43:39 UTC, Paul Backus wrote: If you want the GC to clean up your memory, use `new` to allocate it instead of `malloc`. Like this: ```d mystruct* getmystruct() { return new mystruct; } ```

Memory leak issue between extern (c) and D function

2023-04-13 Thread backtrack via Digitalmars-d-learn
Dear All, I am new to D lang. I have been given a task to consume the .dll generated from a D lang project. I added extern (c) function for call the .dll from CPP file. i have code like below ``` // myfile.d extern(c) { mystruct* getmystruct() { mystruct* mystruct = cast(m