Hello community! I am a new and enthusiastic user of nim, which now I'd like to
go to the next step.
I am trying to use nim to call the Parallel's C API, to manage my virtual
machines in the comfort and flexibility of nim. This means that I have to keep
reference of obscure pointers to virtual machines (!!!) and free them (a) when
something goes wrong and (b) when they are not needed any more.
For the (a) part, I was thinking to wrap this pointer on a nim object, which
could be "invalidated" if something goes wrong, to be on the safe side.
My question is mainly for the second part. In the documentation ("Nim Backend
Integration") mentions
> Typically C data structures have their own malloc_structure and
> free_structure specific functions, so wrapping these for the Nim side should
> be enough.
But I haven't found a way to tell nim that "do this when you want to take the
object out of memory". Also, is this code and GC guaranteed to be called when
exiting nim (or when ctr-c is hit) to be on the safe side, or something more
should be done?
Thank you for your attention!