How does D compare to Go when it comes to C interop?

Mike Parker via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 10 06:06:27 PST 2015


On Thursday, 10 December 2015 at 13:52:57 UTC, John Colvin wrote:
> On Thursday, 10 December 2015 at 13:33:07 UTC, Pradeep Gowda 
> wrote:

>> 2. Memory management. (I guess D is not immune from having to 
>> manage memory for the C functions it calls.. but is there a 
>> difference in approach? is it safer in D?)


> 2) You can manipulate the C heap in D just the same as in C. 
> GC-allocated memory in D being passed to C requires more care, 
> but is normally not a problem.

I was going to say the exact same thing, but I do think it's 
worth putting some emphasis on "more care" here. It's true that 
it normally is not a problem, but it's precisely the abnormal 
cases that you will miss when you aren't paying attention.


More information about the Digitalmars-d mailing list