Nice! You're way ahead of me :) Agreed on the mem mgmt problems with void*, this seems like a nice solution. Attachments do imply an extra malloc, but not your second option which I like more. IMO you don't need attchments with the second option - you can use the second option to store a pointer to anything (or a struct full of pointers to manythings) with a proper finalizer and no void* at all. Very neat.