Python calling D

Artem Tarasov lomereiter at gmail.com
Tue Feb 4 04:45:20 PST 2014


On Tuesday, 4 February 2014 at 11:33:40 UTC, Russel Winder wrote:
> The question is how to get this run.

Pointing out obvious things, part 2: wrap it into a C function 
and call that function when loading the Python module.

library.d:
...
extern (C) export void attach() { Runtime.initialize(); }

library/__init__.py:
...
lib = ctypes.CDLL("myawesomelib.so")
lib.attach()

def foo():
     lib.foo()
...



More information about the Digitalmars-d-learn mailing list