I have some tools I'm working on in portable C that works in Windows Visual Studio 2008 and gcc in Ubuntu Linux based on #ifdef _WIN32
but adding support for Solaris seems to be trickier, especially if I want to support cc
as well as gcc
.
For one example I have some code which sprintf
s into an allocated memory buffer which uses vasprintf
on Linux/gcc and _vscprintf
/vsprintf
on Windows/MSVC. Neither are available on Solaris where I could use vsnprintf
but I have no idea what to add to my #ifdef
s or whether I should move to something else.
Hopefully I don't have to move to configure with cygwin, mingw.
The autoconf(1)
manual has a section on portable C programming.