D vs C++

Walter Bright newshound2 at digitalmars.com
Tue Dec 28 04:35:26 PST 2010


KennyTM~ wrote:
> In pure Python you bind C code with the 'ctypes' module.
> 
> from ctypes import *
> xso = CDLL('x.so')
> xso.fooC.restype = c_double
> xso.fooC.argtypes = [c_int]
> ...
> xso.fooC(4)

Compare that with:

extern(C) double foo(int);
foo(4);

and you don't need to build a .so either.


More information about the Digitalmars-d mailing list