imacarthur wrote: > Just tested this on Vista with mingw, and it fails exactly as Greg's VS > example fails (because mingw mainly just wraps the native system libs in > general.)
That's strange. I can't confirm this with WinXP and the cygwin/mingw compiler (neither in cygwin nor in mingw (-mno-cygwin) compilation mode. I saved Greg's example code as snprintf.cxx What I get is: $ g++ -o snprintf snprintf.cxx && ./snprintf RET=6, SS='123456': TEST RESULT: OK RET=7, SS='1234567': TEST RESULT: OK RET=8, SS='1234567': TEST RESULT: OK RET=9, SS='1234567': TEST RESULT: OK RET=10, SS='1234567': TEST RESULT: OK The same with "-mno-cygwin": $ g++ -o snprintf -mno-cygwin snprintf.cxx && ./snprintf RET=6, SS='123456': TEST RESULT: OK RET=7, SS='1234567': TEST RESULT: OK RET=8, SS='1234567': TEST RESULT: OK RET=9, SS='1234567': TEST RESULT: OK RET=10, SS='1234567': TEST RESULT: OK > However, the workaround of using _snprintf_s(...) doesn't look like it > will fly either, since neither _snprintf_s nor the _TRUNCATE macro are > defined in mingw... Same here. Then I tried this: #ifdef _WIN32 extern "C" int fl_snprintf(char *, size_t, const char *, ...); #define snprintf fl_snprintf #endif /*MICROSOFT*/ instead of trying to use _snprintf_s, because we do already have this in src/vsnprintf.c :-) Compiling with fltk-config: $ ../fltk-config --compile snprintf.cxx && ./snprintf g++ -I.. -I../png -I../zlib -I../jpeg -mwindows -DWIN32 -DUSE_OPENGL32 -mno-cygwin -I/usr/local/hs/include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -o 'snprintf' 'snprintf.cxx' -mwindows -mno-cygwin -L/usr/local/hs/lib ../lib/libfltk.a -ldl -lole32 -luuid -lcomctl32 RET=6, SS='123456': TEST RESULT: OK RET=7, SS='1234567': TEST RESULT: OK RET=8, SS='1234567': TEST RESULT: OK RET=9, SS='1234567': TEST RESULT: OK RET=10, SS='1234567': TEST RESULT: OK Looking in the code, it appears that fl_snprintf calls vsnprintf, and that seems to work (I have HAVE_VSNPRINTF and HAVE_SNPRINTF defined in config.h, otherwise these calls would be redefined to call their fl_* replacements). Albrecht _______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
