Hi Jean,
You could just turn that into a syntax-case macro, use gensym to generate the names, and insert them using with-syntax or quasisyntax.
Yes, this is what I ended up doing before I saw your other reply.
By the way, I'm rather confused as to why you deem this caching useful. A priori, I would expect a simple bytevector->pointer call would be just as fast as a to-pointer call. Do you somehow create lots of pointers to the contents of the same bytevector so that weak references they hold incur a noticeable GC overhead?
To be honest I don't know enough about C to know the performance of bytevector->pointer, so I was assuming Chickadee's approach was done for a reason. But if you think it's not a big deal then I'm happy to simplify things! I think I will remove this caching for now.
Thanks for your help, and Arne as well for digging into the issue. Best, Walter