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

Gary Willoughby via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 10 09:16:43 PST 2015


On Thursday, 10 December 2015 at 13:33:07 UTC, Pradeep Gowda 
wrote:
> I read this post about the difficulties of using go/cgo to 
> interface with C code: 
> http://www.cockroachlabs.com/blog/the-cost-and-complexity-of-cgo/
>
> How does D do in comparison? specifically in regards to:
>
> 1. Call overhead (CGo is 100 times slower than native Go fn 
> call)
> 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?)
> 3. Cgorountes != goroutines (This one may not apply for D)
> 4. Static builds (how easy/straight-forward is this in D?)
> 5. Debugging (ease of accessing C parts when debugging)

Some reading:

https://dlang.org/spec/interfaceToC.html
http://wiki.dlang.org/D_binding_for_C


More information about the Digitalmars-d mailing list