Python calling D

John Colvin john.loughran.colvin at gmail.com
Wed Dec 11 04:05:33 PST 2013


On Wednesday, 11 December 2013 at 05:30:49 UTC, CJS wrote:
> I'd like to use cython to wrap a D library. It's possible to do 
> this with a statically compiled C library, but it fails when I 
> try with a statically compiled D library. Any suggestions on 
> how to do this successfully?

1) have you declared the functions you want to call with 
extern(C)?

2) you will need to compile the D code as a shared library.

3) you will need to call rt_init / rt_term to start / stop the 
runtime in order to use some features of D. There are problems 
with the runtime when using multiple D shared libraries, so it's 
best to link everything you need as a single shared lib.


More information about the Digitalmars-d-learn mailing list