Reuse "pack"ed buffers?

Started by AVC, March 28, 2021, 09:41:35 AM

Previous topic - Next topic

AVC

Hello,

is there a way to re-utilize a buffer created with "pack"? What I mean is:
[list=]
  • You create a buffer using "pack" with some values
  • [/list]

    [list=]
  • You keep the address of the buffer in a symbol (maybe a default functor) so it isn't deleted automatically
  • [/list]

    [list=]
  • You "repack" the existing buffer passing the symbol or the address stored in it, writing new values into the buffer, but without allocating new memory
  • [/list]

    I think this possibility would be useful f.eg. in working with C libraries that make heavy use of buffer pointers (OpenGL, SDL etc.) and could play nicely with "struct".

    Thanks and best regards

    Alfonso