How to use VaList

You can use vasprintf to print to allocated String. Crystal doesn’t have wrapper for that, but it will be quite straight-forward to have them included. So something like below should work for your use case.

lib C
   fun vasprintf(strp : LibC::Char**, format : LibC::Char*, ap : Void*) : LibC::Int
end
....
C.vasprintf(out msg, raw_message, raw_args)
formatted_msg = String.new(msg)
....

Please bear in mind that vasprintf allocates the memory and returns number of bytes printed or -1 on memory allocation error.

So you should be responsible for freeing the memory, when you are done with that.

HIH