On Monday, 17 December 2012 at 14:06:30 UTC, Mike Parker wrote:
Now what i was thinking as a solution, would it be possible to
manually run the GC cleanup pass at the end of main this way
we know that the GC cleanup would run before main exits and
thus sfml gets unloaded. Although i believe this still doesn't
guarantee that it will think the class is fit for
deconstruction at that point so it may still no work but just
a thought.
There's no reason to do that. If you have any external
resources to cleanup, just clean it up yourself. The init/term
pattern I posted earlier works just fine.
I understand that your method would work and that's fair enough
but as people have indicated they still want to keep GC feel
across their code rather then some parts that need manual
destruction or termination and other things that don't so i was
thinking this may be a way of doing that.
Just cause there is another way of doing it doesn't mean i don't
want to know if the way i thought of is possible or not.
Maybe since there (practically) has to be a manual destroy method
when people are making these wrappers in D for things like SFML,
if they still want to have the appearance or feeling of it still
using the same GC'd scheme like the rest of D is to implement
some kind of reference counting in the wrapper that is
transparent so that to the user it seems like the rest of D.
I am not interested in making a OO SFML wrapper myself but it
seems some of the responders are so i am just trying to help in
whatever limited way i can.