In my opinion, it is a very bad idea to use varargs in exported functions.
It might be useful for you to see how a similar task is solved in libxml2:
File xmlwriter.c
/*
* The following VA_COPY was coded following an example in
* the Samba project. It may not be sufficient for some
* esoteric implementations of va_list but (hopefully) will
* be sufficient for libxml2.
*/
#ifndef VA_COPY
#ifdef HAVE_VA_COPY
#define VA_COPY(dest, src) va_copy(dest, src)
#else
#ifdef HAVE___VA_COPY
#define VA_COPY(dest,src) __va_copy(dest, src)
#else
#ifndef VA_LIST_IS_ARRAY
#define VA_COPY(dest,src) (dest) = (src)
#else
#include <string.h>
#define VA_COPY(dest,src) memcpy((char *)(dest),(char *)(src),sizeof(va_list))
#endif
#endif
#endif
#endif
And SDL2. File SDL_vacopy.h
/* Do our best to make sure va_copy is working */
#if defined(__NGAGE__)
#undef va_copy
#define va_copy(dst, src) dst = src
#elif defined(_MSC_VER) && _MSC_VER <= 1800
/* Visual Studio 2013 tries to link with _vacopy in the C runtime. Newer versions do an inline assignment */
#undef va_copy
#define va_copy(dst, src) dst = src
#elif defined(__GNUC__) && (__GNUC__ < 3)
#define va_copy(dst, src) __va_copy(dst, src)
#endif
And use in your xPmPrintf something like that:
va_copy(local_va_list, given_va_list);
vsnprintf(..., ..., fmt, local_va_list);
va_end(local_va_list);