A question about moving GC

Max Samuha maxter at i.com.ua_spamless
Sat Jun 3 01:34:52 PDT 2006


How to ensure D code that interoperates with external libraries will
work when a moving gc is eventually used with D? Will i need to add
lots of pinning/unpinning code?

extern(C) external(Foo* foo); 

struct Foo
{
}

class Bar
{
	Foo foo;
}

main()
{
	Foo* foo = new Foo();
	
	// Should foo be pinned before the call?
	external(foo);

	Bar bar = new Bar();

	// Should bar be pinned before the call?
	external(&bar.foo);
}


btw, ares seems to provides a moving gc and does have a gc.pin method.
Should i consider looking closer at ares? Thanks



More information about the Digitalmars-d-learn mailing list