[Spice-devel] [vdagent-win V2 4/6] Fix Visual Studio compiler warning (sscanf/strcat)

Christophe Fergeau cfergeau at redhat.com
Mon Oct 20 08:23:26 PDT 2014


On Mon, Oct 20, 2014 at 05:34:24PM +0300, Uri Lublin wrote:
> On 10/15/2014 04:34 PM, Christophe Fergeau wrote:
> >On Mon, Oct 13, 2014 at 05:26:17PM +0300, Uri Lublin wrote:
> >>Finally got to give your suggestion a try.
> >>My system is Fedora 20, with mingw32-headers-3.2.0-1.fc20.noarch installed.
> >>
> >>At first I was able to build with strcat_s, but the program failed to run on
> >>Windows XP, claiming it was missing that function.
> >>As you've mention sscanf_s needs to be declared in the src file, but the
> >>program
> >>failed to run on Windows XP, claiming it was missing that function. (This
> >>should
> >>probably be added to mingw's sec_api/string.h)
> >>After playing with it, I was able to make it work, by linking with
> >>-lmsvcr100
> >>and installing "Microsoft Visual C++ 2010 redistributable (x86)" on the
> >>Windows XP.
> >But when building with vc++, you can use strcat_s without installing
> >this runtime?
> 
> When compiled with Visual Studio:
> If compiled in static mode (with C/C++ -> Code Generation -> Runtime Library
> set to Multi-threaded  (/MT)) it works without installing the
> redistributable runtime dll.
> If compiled in dynamic (DLL) mode (with Runtime Library flag above set to
> Multi-threaded DLL (/MD) it does not work, unless this runtime dll is
> installed.
> 
> By default spice vdagent-win is compiled with /MT in "Release" builds.

Ah ok, we are making static builds. Then ACK to your patch, though it
would be worth adding these explanations to the log or as comments
(mingw + winxp don't have these _s functions, require a newer mscrt
runtime, not an issue with vc++ because of static link).
Thanks a lot for the detailed explanations!

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20141020/6673dcae/attachment.sig>


More information about the Spice-devel mailing list