-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Andrew Dunbar:
I've got a little program to index dump files that supports Windows and Linux but it doesn't compile on the Toolserver with either cc or gcc due to the lack of the function vasprintf(). It's a GNU extension so I'm surprised it didn't work even with gcc.
Why doesn't the Toolserver gcc have it, and does anybody know of a workaround?
*printf() is not part of the compiler, but the C library (libc); GNU glibc (used on Linux) provides it, while Solaris doesn't. There's been some discussion about it, but there are several incompatible asprintf() interfaces around and it's not clear which one should be implemented.
Someone else already provided a version using snprintf, but you could also use g_vasprintf() from glib, or the version from gettext's libintl.h (which means you need to include <libintl.h> and link against - -lasprintf, both of which live in /opt/ts/gettext). I personally find the snprintf solution the best and this is what I use in my own code.
- river.