I have a Nimrod class that essentially encapsulates a number of resources provided by external C libraries. I want the class instances to behave like native born an bred Nimrod instances, and thus I would like the external resources to be transparently freed when the instance is garbage collected.
Is there any way to do this, or am I forced to bother api consumers with explicit destruction?
Isn't the destructor pragma what you want as well? I gather that it's the recommended way, in preference to finalizers.
Yeah thanks, I was about to say: I find no mention of destructors in the garbage collector, and no indication that destructors are being assigned as finalizers in generated code.
FWIW I wish finalizers could be attached with a pragma at some point.
Anyway, thanks for being so responsive and helpful, both of you!