There is a runtime.SetFinalizer function. On Sunday, November 22, 2020 at 8:13:22 PM UTC+8 Sean wrote:
> I am writing a Golang wrapper for OpenAL-Soft. > I need to create some buffers. These operations are happening on the > OpenAL-Soft side (So C functions). I am loading PCM data into buffers. > > Can I set up a trigger mechanism like "x.__del__" as in Python? > > I can set the garbage collector to follow some objects. > But I have to call some C functions (alDeleteBuffers) to delete buffers > in OpenAL. > > I want garbage collector to run this function while deleting the object. > > Is this possible? > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/398098b5-06bf-416b-95cc-b6efd59517dfn%40googlegroups.com.