I analyzed problem a little bit. Only gcc/clang allows to use this trick. Msvc compiler forbidens such code (even with different enabled optimizations like remove unused references, whole program optimization etc) I have made patch, which uses preprocessor #if directive instead. If it will be helpful, I can share the patch.
вт, 31 мая 2022 г. в 17:24, Andreas Rheinhardt < andreas.rheinha...@outlook.com>: > Timo Rothenpieler: > > On 31.05.2022 12:03, Александр wrote: > >> I tried to build ffmpeg 4.4 library and link with it and I received > >> multiple unresolved references. I came across on unusual architecture in > >> ffmpeg for multiple platforms.The library has many places with code like > >> this: > >> > >> void foo() > >> { > >> // DO SOMETHING > >> if (ARCH_MIPS) // maybe #if ARCH_MIPS (...) #endif should be used > >> instead? > >> foo_mips(...); > >> if (ARCH_PPC) > >> foo_ppc(c); > >> if (ARCH_ARM) > >> foo_arm(...); > >> if (ARCH_AARCH64) > >> foo_aarch64(...); > >> } > >> > >> This code leads to linker errors because there is no any stub methods > for > >> other platforms. I observed root MakeFile, it optionally includes > >> platform > >> dependent code for each library (path like > >> $(LIB_SUBDIR)/$(ARCH)/MakeFile) > >> where each foo_<arch> is defined. > >> > >> So, how does it work? > > > > It relies on Compiler-Optimizations, namely Dead-Code-Elimination. > > For that reason, FFmpeg does not support being built with -O0, since the > > compiler won't eliminate the dead code, leading to a whole bunch of dead > > references. > > > > Incorrect: Both GCC and Clang eliminate dead code at -O0 and FFmpeg can > be built with -O0 with both of them just fine. > > > Hence, if you run into an issue like that, you need to look at your > > compiler and figure out what the hell it's trying to do. > > Or stop trying to build with -O0, which the build system should normally > > never allow you to do in the first place unless you force it. > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".