I'm trying to implement a variadic function declared as sysv_abi, so I have to use va_start in this function, but didn't find a way.
I compile the code on Win64, using vs2017, the compiler is clang-cl. The target is a x86_64 executable(PE file on windows, of course).
int __attribute__((sysv_abi)) my_sprintf_s(char *buffer, size_t sizeOfBuffer, const char *format, ...)
{
va_list arg_list;
va_start(arg_list, format);
int ret = vsprintf_s(buffer, sizeOfBuffer, format, arg_list);
va_end(arg_list);
//__builtin_va_list v_list;
//__builtin_va_start(v_list, format);
//int ret = vsprintf_s(buffer, sizeOfBuffer, format, v_list);
//__builtin_va_end(v_list);
return ret;
}
Neither will compile, I get:
error : 'va_start' used in System V ABI function
How can I deal with this?