template forward reference

Kirk McDonald kirklin.mcdonald at gmail.com
Wed Aug 1 23:57:09 PDT 2007


C. Dunn wrote:
> Kirk McDonald Wrote:
> 
>> C. Dunn wrote:
>>> Kirk McDonald Wrote:
>>>> Goodness. That looks familiar. I used to have all kinds of problems with 
>>>> that in Pyd, but some DMD version or other cleared it all up. Which 
>>>> version of the compiler are you using?
> 
> Hey!  Do you work on Pyd?

I wrote it. :-)

> Maybe you can answer a question for me:  Is the D garbage collector aware of the references in Python to D data?
> 
> With SWIG, some languages can have problems when the pointer is stored as a string.  I just want to be sure that with Pyd it is not mangled somehow to fool the gc.  You probably already thought of this, but I just want to be sure.  I didn't notice it in the docs.
> 
> Python is a reference-counted language, so the interaction with a garbage-collector is interesting.
> 

Pyd keeps references to all items which are returned to Python, until 
the Python object wrapping the D item is collected, at which time the 
stored reference is cleared. The D GC does not scan any of the memory 
allocated by Python, which includes all Python objects. Thus this 
reference-keeping must be done manually by Pyd.

It turns out this is a surprisingly difficult problem to solve 
correctly, and I've expended quite a lot of effort to get it right.

> 
> 
>> The Linux download is the same as the Windows one. Just be sure you 
>> follow the installation instructions to the letter:
>>
>> http://www.digitalmars.com/d/dcompiler.html#linux
> 
> Yes, but how do I get 2.0 for Linux?  I ended up with 1.015.
> 

At the 2.0 changelog:

http://digitalmars.com/d/changelog.html

Click on the D 2.003 link.

-- 
Kirk McDonald
http://kirkmcdonald.blogspot.com
Pyd: Connecting D and Python
http://pyd.dsource.org



More information about the Digitalmars-d mailing list