Re: [Mingw-users] Multiple definition of `vsnprintf' when building C++ programs
- Date: Wed, 10 May 2017 21:14:02 +0100
- From: Keith Marshall <keithmarshall@xxxxxxxxxxxxxxxxxxxxx>
- Subject: Re: [Mingw-users] Multiple definition of `vsnprintf' when building C++ programs
-----BEGIN PGP SIGNED MESSAGE-----
On 10/05/17 18:15, Eli Zaretskii wrote:
>> ... what is the difference between my link and yours? Dynamic vs.
>> static linking of libmingwex, perhaps?
> Yes, I link libmingwex statically.
As it is your right to choose; I respect that.
> It is of course expected that linking against a DLL will not hit this
> problem. I'd like to avoid a dynamic link against libmingwex, because
> otherwise distributing a GDB binary would need to distribute the
> libmingwex DLL, which increases the probability of a DLL hell on the
> end-user's machines,
libmingwex.dll will be versioned, following libtool guidelines, so
this _shouldn't_ become an issue.
> and also will require me to provide the sources for libmingwex near
> the binaries.
The MIT/X.org licence of libmingwex.dll _doesn't_ impose any such
requirement, so unless you consider that GDB's GPL stomps on that
freedom, then no, with the IANAL proviso, I don't think it would.
> So I hope you will find a solution that works for static linking as
Declaring snprintf and vsnprintf as weak symbols, for the libmingwex
build, does the trick, but it isn't my preferred solution. In fact,
the more I look into it, the less I like the change which introduced
the problem; I'm inclined to revert:
Apart from _completely defeating_ -Wformat checking for snprintf(),
and vsnprintf(), (which will _always_ get it wrong WRT one or other
of the two subsets of format specifiers which are _not_ within the
intersection of the ms_printf and gnu_printf sets), it offers no
real value; in fact, it seems more harmful than useful.
Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)
-----END PGP SIGNATURE-----
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
MinGW-users mailing list
This list observes the Etiquette found at
We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.
You may change your MinGW Account Options or unsubscribe at: