After some tests: 1) #undef far after #include <windows.h> is wrong -- in oleauto.h is declaration WINOLEAUTAPI VarUI1FromI8(LONG64 i64In, _Out_ BYTE FAR* pbOut); and 'FAR' is defined as 'far' which is define as empty.
2) #undef near after #include <windows.h> works in ffmpeg but is danger -- see 1) 3) after git revert 3701d499f8734ec5f3e7359de7311b15d92070b0 git revert 590136e78da3d091ea99ab5432543d47a559a461 and patch diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c - MXFPackage packages[2] = {}; + MXFPackage packages[2] = {{NULL}}; VS 2017 can compile ffmpeg and fate stops at audiomatch-nero-16000-mono-he-m4a (without reverting 590136e hangs at api-flac-test.exe) 4) if for any reasons commits 3701d49 and 590136e shouldn't be reverted, we can apply this patch and diff --git a/libavcodec/utils.c b/libavcodec/utils.c index baf09119fe..b34a3803b8 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1943,7 +1943,7 @@ int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)) int ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec) { - _Bool exp = 0; + atomic_bool exp = 0; if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !codec->init) return 0; @@ -1969,7 +1969,7 @@ int ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec) int ff_unlock_avcodec(const AVCodec *codec) { - _Bool exp = 1; + atomic_bool exp = 1; if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !codec->init) return 0; Mateusz W dniu 04.12.2017 o 20:27, Mateusz pisze: > W dniu 04.12.2017 o 15:02, Derek Buitenhuis pisze: >> On 12/4/2017 8:03 AM, Mateusz wrote: >>> After commit 3701d49 'error_resilience: remove avpriv_atomic usage' >>> we have included windows.h in much more files and we should >>> avoid conflicts with defines/function declarations. >>> >>> Signed-off-by: Mateusz Brzostek <mateu...@poczta.onet.pl> >>> --- >>> libavcodec/jpegls.h | 4 ++++ >>> libavcodec/mss2.c | 6 +++--- >>> libavformat/mxfenc.c | 2 +- >>> 3 files changed, 8 insertions(+), 4 deletions(-) >> >> Sprinkling these weird ifdefs and renames around is pretty ugly. Is there >> some sort of canonical list on MSDN or something we can use globally-ish? >> >> - Derek > > There is a list of "Predefined Macros" in MSVC -- IMO there are OK > https://msdn.microsoft.com/en-us/library/b0084kay(v=vs.140).aspx > > More danger are macros from windows.h -- there is a list of macros > to exclude some parts (from MSDN and windows.h): > Define WIN32_LEAN_AND_MEAN to exclude APIs such as > Cryptography, DDE, RPC, Shell, and Windows Sockets. > > /* If defined, the following flags inhibit definition > * of the indicated items. > * > * NOGDICAPMASKS - CC_*, LC_*, PC_*, CP_*, TC_*, RC_ > * NOVIRTUALKEYCODES - VK_* > * NOWINMESSAGES - WM_*, EM_*, LB_*, CB_* > * NOWINSTYLES - WS_*, CS_*, ES_*, LBS_*, SBS_*, CBS_* > * NOSYSMETRICS - SM_* > * NOMENUS - MF_* > * NOICONS - IDI_* > * NOKEYSTATES - MK_* > * NOSYSCOMMANDS - SC_* > * NORASTEROPS - Binary and Tertiary raster ops > * NOSHOWWINDOW - SW_* > * OEMRESOURCE - OEM Resource values > * NOATOM - Atom Manager routines > * NOCLIPBOARD - Clipboard routines > * NOCOLOR - Screen colors > * NOCTLMGR - Control and Dialog routines > * NODRAWTEXT - DrawText() and DT_* > * NOGDI - All GDI defines and routines > * NOKERNEL - All KERNEL defines and routines > * NOUSER - All USER defines and routines > * NONLS - All NLS defines and routines > * NOMB - MB_* and MessageBox() > * NOMEMMGR - GMEM_*, LMEM_*, GHND, LHND, associated routines > * NOMETAFILE - typedef METAFILEPICT > * NOMINMAX - Macros min(a,b) and max(a,b) > * NOMSG - typedef MSG and associated routines > * NOOPENFILE - OpenFile(), OemToAnsi, AnsiToOem, and OF_* > * NOSCROLL - SB_* and scrolling routines > * NOSERVICE - All Service Controller routines, SERVICE_ equates, > etc. > * NOSOUND - Sound driver routines > * NOTEXTMETRIC - typedef TEXTMETRIC and associated routines > * NOWH - SetWindowsHook and WH_* > * NOWINOFFSETS - GWL_*, GCL_*, associated routines > * NOCOMM - COMM driver routines > * NOKANJI - Kanji support stuff. > * NOHELP - Help engine interface. > * NOPROFILER - Profiler interface. > * NODEFERWINDOWPOS - DeferWindowPos routines > * NOMCX - Modem Configuration Extensions > */ > > The most danger are small caps macros defined as empty in minwindef.h: > far > near > pascal > cdecl > > I think it is possible to make in ffmpeg's *.h files which include windows.h > something like this: > #define WIN32_LEAN_AND_MEAN > #define NOMINMAX > #define NOGDI > #include <windows.h> > #undef far > #undef near > #undef pascal > #undef cdecl > > I will make some test and write back. > > Mateusz _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel