Python calling D

Ellery Newcomer ellery.newcomer at utulsa.edu
Thu Jan 23 18:29:05 PST 2014


On Monday, 20 January 2014 at 02:30:46 UTC, CJS wrote:
>
> For future reference, I tried but wasn't able to make calling D 
> from python work. I tried to just compile D to an .a library, 
> including statically linking phobos, and then wrapping it with 
> cython like I would with C code. (I've made this work before 
> with C.)

python wants shared libs, not static libs. but this is very 
fiddly. so use pyd.

1. clone the ariovistus/pyd repo
2. from top dir, type

python setup install
python runtests.py hello

(or
cd examples/hello
python setup.py build
python test.py)

this will run the code found in examples/hello (it's a simple 
python calls D)

use python 2.7 and have dmd 2.064 on your path somewhere. It 
should just work.


More information about the Digitalmars-d-learn mailing list