Iām a leading developer of Bitfighter and I have problems porting the game to 64-bit Linux. This should be a relatively simple and common problem, but it has surpassed many people, and I could not find any good information about it.
[[The code compiles in the 32-bit version with gcc version 4.1.2 and others and does not work with several versions of 64-bit Linux, but I rely on reports from others and do not have the exact version of gcc that fails. But it fails for a few people, on different tastes of Linux. I am 99% sure that this is not a problem with the compiler version. ]]
I have the following:
void UserInterface::drawCenteredString(int y, int size, const char *format, ...)
{
va_list args;
va_start(args, format);
char buffer[2048];
dVsprintf(buffer, sizeof(buffer), format, args);
va_end(args);
drawCenteredString2(y, size, buffer);
}
S32 dVsprintf(char *buffer, int bufferSize, const char *format, void *arglist)
{
return vsnprintf(buffer, bufferSize, format, (char *) arglist);
}
This works great on 32-bit platforms. However, when I compile it on 64-bit Linux, it fails:
platform.cpp:457: error: cannot convert 'char*' to '__va_list_tag*' for argument '4' to 'int TNL::vsnprintf(char*, size_t, const char*, __va_list_tag*)'
, :
return vsnprintf(buffer, bufferSize, format, (va_list) arglist);
.
- , , 64- ?
, :-) - , va_list_tag?
!
============================================ >
, , :
logprintf("Hello %s", name);
void logprintf(const char *format, ...)
{
va_list s;
va_start( s, format );
logger(LogConsumer::GeneralFilter, format, s);
va_end(s);
}
void logger(LogConsumer::FilterType filtertype, const char *format, va_list args)
{
char buffer[4096];
vsnprintf(buffer, sizeof(buffer), format, args);
Platform::outputDebugString(buffer);
}