Is there a way to create a va_list
from scratch? I\'m trying to call a function that takes a va_list
as a parameter:
func(void **e
Your idea of a proxy function that creates the va_list
is the right way to do it. There is no need for that proxy to have public scope. However, if you might find that the proxy already exists. For instance, in many library implementations sprintf()
is just a proxy for vsprintf()
.
Unless you are willing to tie your code to a specific compiler and target platform, there is no better way. The names defined in
are there to provide a portable and consistent interface to support access to variadic argument lists. The only portable way to implement and use variadic functions is through that interface.
That said, it is possible that you could sacrifice portability by duplicating a call frame in an array and hand construct a va_list
that correctly references it. The result will never be portable.