Python calling D

Russel Winder russel at winder.org.uk
Fri Jan 24 02:55:02 PST 2014


On Fri, 2014-01-24 at 02:29 +0000, Ellery Newcomer wrote:
[…]

I have just tried a trivial D source shared object on Debian Unstable
using DMD 2.064.2 from d-apt. Compile up the shared object with entries
C linkage, try to use ctypes or CFFI from Python just gives a
segmentation violation :-(

> 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

Probably want to use a virtualenv for this rather than install into the
base installation

> (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.

It needs to work for Python 3.3 as well!

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder



More information about the Digitalmars-d-learn mailing list