> Andy Polyakov wrote: > Hi, > >> The recently released preview of MSVC14 has changed the ABI for the C >> Runtime library. The intent is to avoid having to change it again in >> the future, so that DLLs linked against the current version will be >> able to safely use later versions. >> >> In e_os.h there is the following code which does not work correctly >> with MSVC14, because the signature and semantics of __iob_func have >> changed. >> >> # if defined(_MSC_VER) && !defined(_DLL) && defined(stdin) >> # if _MSC_VER>=1300 >> # undef stdin >> # undef stdout >> # undef stderr >> FILE *__iob_func(); >> # define stdin (&__iob_func()[0]) >> # define stdout (&__iob_func()[1]) >> # define stderr (&__iob_func()[2]) >> >> I have built successfully with the condition changed to: >> >> # if _MSC_VER>=1300 && _MSC_VER<1900 >> >> However, since I don't fully understand why it is necessary to >> redefine these variables, I can't be sure that this is the correct >> fix. I have successfully built, but have not run thorough tests (let >> me know if there's an appropriate command I could use to verify my >> build). > > The original reason for redefining these macros was to produce object code > that > can be used both to link statically into application and as part of a shared > library. It's ever-lasting /MT vs. /MD "feud". The issue is discussed in > RT#1230. Since the ticket in question the build procedure was amended to /MT > /Zl, so that you don't have to specify /NODEFAULTLIB. > > As for what to do. As far as I recall the "tangible" reason for redefine was > that [by 1300 time] definition depended on compiler command line options (or > wasn't a call to function). If definition does not depend on command line > *now*, > *and* always resort to function call, then it would be appropriate to to add > "&& > _MSC_VER<1900", or in fact whichever version when it became invariant. I don't > have possibility to check > MSVC14 for time being, but it seems to be case already in MSC10 or > _MSC_VER==1600. Could you double-check MSCV14, while I do some testing with > earlier version?
The definition almost certainly depended on the version of the CRT up until VC14, since FILE was a public type. As of 14.0, FILE is an opaque type and the public definition won't be changing again (for the foreseeable future). It definitely does not depend on command line flags anymore. I don't have any special insight into earlier versions of VC, but since they seem to work fine I'd view disabling this for VC14+ only as the safer option. Of course, you're free to do the research and make the changes, but if nobody else has mentioned it then I'm sure it's fine. Cheers, Steve :��I"Ϯ��r�m���� (����Z+�7�zZ)���1���x��h����W^��^��%�� ��&jם.+-1�ځ��j:+v�������h�
