www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - windows DLL

reply bero <berobero users.sourceforge.net> writes:
There are windows dll example in dmd/samples/d/mydll.
It looks each dll has own gc.

If instance allocated in main program points instance allocated in dll
or vice velsa, whats happen?
as main GC, instance pointed from dll gc looks garbage, so it will freed.

One of the safety way is, sepalete gc (or whole phobos) as dll,
and both program and dll link it to use only one gc.

any suggestion?

BERO
Mar 25 2005
parent reply Chris Sauls <ibisbasenji gmail.com> writes:
Walter came up with an interesting new method of working with DLL's in D
not that long ago.  Check out:
http://www.digitalmars.com/d/dll.html

In particular look at the section "D code calling D code in DLLs" to see
 the use of std.gc.setGCHandle(), std.gc.getGCHandle(), and
std.gc.endGCHandle() functions.

-- Chris Sauls

bero wrote:
 There are windows dll example in dmd/samples/d/mydll.
 It looks each dll has own gc.
 
 If instance allocated in main program points instance allocated in dll
 or vice velsa, whats happen?
 as main GC, instance pointed from dll gc looks garbage, so it will freed.
 
 One of the safety way is, sepalete gc (or whole phobos) as dll,
 and both program and dll link it to use only one gc.
 
 any suggestion?
 
 BERO

Mar 25 2005
parent bero <berobero users.sourceforge.net> writes:
Chris Sauls wrote:
 Walter came up with an interesting new method of working with DLL's in D
 not that long ago.  Check out:
 http://www.digitalmars.com/d/dll.html
 

Mar 25 2005