Calling D from C, C++, Python…

Russel Winder via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Sep 12 01:56:58 PDT 2015


On Fri, 2015-09-11 at 21:50 +0200, Jacob Carlborg via Digitalmars-d
-learn wrote:
> On 2015-09-10 20:01, Russel Winder via Digitalmars-d-learn wrote:
> > Is there an easy way of knowing when you do not have to initialize
> > the
> > D runtime system to call D code from, in this case, Python via a C
> > adapter?
> 
> You always need to initialize the D runtime, unless you have a D main
> function. You can initialize the runtime as many times you like, 
> assuming you also deinitialize it the same number of times.

I have a small D function (C linkage) compiled to a shared object that
I am calling from Python via CFFI that works fine with no D runtime
initialization. Thus I have experimental evidence "always" is not
entirely the case! I really need to explore the boundaries of what
point you have to actually initialize the D runtime…

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150912/95229d85/attachment.sig>


More information about the Digitalmars-d-learn mailing list