Building juju-core on Windows

John Arbash Meinel john at arbash-meinel.com
Thu Mar 14 04:12:36 UTC 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2013-03-14 7:50, John Arbash Meinel wrote:
> ...
> 
>>> 7) On Windows, 'strdup' is available as '_strdup', so you need
>>> a workaround like: +#ifdef WIN32 +#define strdup _strdup
>>> +#endif
>>> 
>>> There are a lot more funcs like this, but goyaml isn't calling 
>>> them directly.
> 
>> Should be able to just define _CRT_NONSTDC_NO_DEPRECATE for
>> this:
> 
>> <http://msdn.microsoft.com/library/ms235384>
> 
>> Martin
> 
> 
> This didn't actually work, probably because it is being compiled
> with MinGW and not MSVC. My guess is that the actual functions in
> the CRT are "_strdup" but setting the above header (and importing
> windows.h?) will get you to import the "#define strdup _strdup" for
> you.
> 
> So I still need the #define, but I don't need libyaml.
> 
> John =:->

I dug out a copy of VS Express, and traced into the header files. It
does seem to be specific to MSDN. It actually lets you use "strdup"
but then gives you a warning that the POSIX name is deprecated (in
favor of the ISO C++ name).

_Check_return_ _CRT_NONSTDC_DEPRECATE(_strdup) _CRTIMP char * __cdecl
strdup(_In_opt_z_ const char * _Src);

#define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT("The
POSIX name for this item is deprecated. Instead, use the ISO C++
conformant name: " #_NewName ". See online help for details.")

#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))

So essentially, it just adds __declspec(deprecated(...)) unless you
set the macro yourself. Which means it just toggles the warning, and
I'm guessing MinGW doesn't have the compatibility layer into the CRT
that MSVC has.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlFBTjQACgkQJdeBCYSNAANTygCdG16arFjNBSQVVWwYbn16MTEZ
OOUAoMVy4ktAP/65gq3xMKVAFShUohgg
=HKWT
-----END PGP SIGNATURE-----



More information about the Juju-dev mailing list