Common code:
```d
module common;
interface IFont
{
IFont createFontWithSize(int size);
}
```
Executable Code:
```
import common;
class TTFFont : IFont
{
IFont createFontWithSize(int size){return new TTFFont;}
}
export extern(System) IFont newFont()
{
auto ret = new TTFFont();
GC.addRoot(ret);
return ret;
}
```
DLL Code:
```
import common;
Runtime.initialize();
IFont function() newFont;
newFont = loadSymbol("newFont");
IFont myFont = newFont(); //GC root ok, does not get collected
IFont otherFont = myFont.createFontWithSize(32); //Gets collected after some time
```
As my object that creates another object is rooted, should not it create another rooted object?
Comment #1 by robert.schadek — 2024-12-13T19:25:16Z