[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 3/8] Update snprintf.c

From: Fabrizio Gennari
Subject: Re: [PATCH v2 3/8] Update snprintf.c
Date: Thu, 6 Dec 2018 23:34:31 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

A possible (unconfirmed) explanation of why it broke. Maybe old version of MinGW, from the time common/snprintf.c was added, did not define vsnprintf and snprintf, but only _vsnprintf and _snprintf. Now things break because vsnprintf and snprintf clash with those in common/snprintf.c (and common/snprintf.c is included in the build because vsnprintf and snprintf provided by Windows are not C99-compliant). In the new version of common/snprintf.c from Samba there is no such clash any more.

If making Samba's version of snprintf part of gnokii API is unacceptable, the only alternative is that both gnokii and libgnokii link common/snprintf.c directly, which will result in some code duplication in the resulting binaries, but sounds like the best compromise.

Il 06-12-18 23:14, Fabrizio Gennari ha scritto:

Il 04-12-18 23:34, Daniele Forsi ha scritto:
Il giorno mar 4 dic 2018 alle ore 22:22 Ladislav Michl ha scritto:
From: Fabrizio Gennari <address@hidden>

Update to the latest version from Samba's repository,;a=blob;f=lib/replace/snprintf.c;hb=9f03cf91235641d017e31abc3856df994e6d1cf2
Did anybody report a bug against the current snprintf in libgnokii?

No bug, it just did not compile (details about the error is below). Since the old version was taken from Samba, and the new version taken from Samba compiled, it was a good reason to replace the old version with the new one.



/bin/bash ../libtool   --tag=CC   --mode=compile i686-w64-mingw32-gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DCOMPILING_LIBGNOKII -I. -I../include -DLIBDIR="\"/usr/local/lib\""  -I../include -mms-bitfields -I/home/fabrizio/dev/gnokii/glibwin/include/glib-2.0 -I/home/fabrizio/dev/gnokii/glibwin/lib/glib-2.0/include  -g -O2 -Wall -Wno-pointer-sign -fvisibility=hidden -fno-strict-aliasing -MT libgnokii_la-snprintf.lo -MD -MP -MF .deps/libgnokii_la-snprintf.Tpo -c -o libgnokii_la-snprintf.lo `test -f 'snprintf.c' || echo './'`snprintf.c libtool: compile:  i686-w64-mingw32-gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DCOMPILING_LIBGNOKII -I. -I../include -DLIBDIR=\"/usr/local/lib\" -I../include -mms-bitfields -I/home/fabrizio/dev/gnokii/glibwin/include/glib-2.0 -I/home/fabrizio/dev/gnokii/glibwin/lib/glib-2.0/include -g -O2 -Wall -Wno-pointer-sign -fvisibility=hidden -fno-strict-aliasing -MT libgnokii_la-snprintf.lo -MD -MP -MF .deps/libgnokii_la-snprintf.Tpo -c snprintf.c  -DDLL_EXPORT -DPIC -o .libs/libgnokii_la-snprintf.o
snprintf.c:772:5: error: redefinition of ‘vsnprintf’
 int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
In file included from ../include/compat.h:22:0,
                 from snprintf.c:62:
/usr/share/mingw-w64/include/stdio.h:558:7: note: previous definition of ‘vsnprintf’ was here    int vsnprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, va_list __local_argv)
snprintf.c:787:5: error: redefinition of ‘snprintf’
 int snprintf(char *str,size_t count,const char *fmt,...)
In file included from ../include/compat.h:22:0,
                 from snprintf.c:62:
/usr/share/mingw-w64/include/stdio.h:569:5: note: previous definition of ‘snprintf’ was here  int snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, ...)
make[2]: *** [Makefile:866: libgnokii_la-snprintf.lo] Error 1
make[2]: uscita dalla directory "/home/fabrizio/dev/gnokii/common"
make[1]: *** [Makefile:927: all-recursive] Error 1
make[1]: uscita dalla directory "/home/fabrizio/dev/gnokii/common"
make: *** [Makefile:501: all-recursive] Error 1

gnokii-users mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]