[FFmpeg-trac] #2049(build system:new): msvc: --extra-cflags="-MD" leads to unresolved externals

FFmpeg trac at avcodec.org
Fri Dec 21 07:17:44 CET 2012


#2049: msvc: --extra-cflags="-MD" leads to unresolved externals
-------------------------------------+-------------------------------------
             Reporter:  Piroxiljin   |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:  build
              Version:  git-master   |  system
             Keywords:  msvc         |               Resolution:
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  0
-------------------------------------+-------------------------------------

Comment (by Piroxiljin):

 Well.
 The source of the trouble is c99wrap. It preprocesses source code with
 commands like
 {{{
 c99wrap cl -I. -I./ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64
 -D_LARGEFILE_SOURCE \
 -Dstrtod=avpriv_strtod -Dsnprintf=avpriv_snprintf
 -D_snprintf=avpriv_snprintf \
 -Dvsnprintf=avpriv_vsnprintf -DHAVE_AV_CONFIG_H -nologo
 -D_USE_MATH_DEFINES \
 -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64   -Oy -Z7 -W4 -wd4244 \
 -wd4127 -wd4018 -wd4389 -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 -wd4152 \
 -wd4324 -we4013 -wd4100 -wd4214 -wd4554 -wd4996 -wd4273 -O2 -MD     -c \
 -Fo libavutil/../compat/msvcrt/snprintf.o
 libavutil/../compat/msvcrt/snprintf.c
 }}}

 Here we have preprocessor defines which replace "snprintf" to
 "avpriv_snprintf"
 Also, preprocessed source file includes declarations of _snprintf ( and
 another functions from standart library). When we compile with -MD, this
 functions declared as
 {{{
 #pragma warning(push)
 #pragma warning(disable:4793)
 __declspec(deprecated("This function or variable may be unsafe. Consider
 using " \
 "_snprintf_s" " instead. To disable deprecation, use
 _CRT_SECURE_NO_WARNINGS. See online help for details.")) \

 __declspec(dllimport) int __cdecl _snprintf(   char *_Dest,   size_t
 _Count,     const char * _Format, ...);\

  __declspec(deprecated("This function or variable may be unsafe. Consider
 using " "_vsnprintf_s" " instead. \
 To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for
 details.")) \

 __declspec(dllimport) int __cdecl _vsnprintf(   char *_Dest,   size_t
 _Count,     const char * _Format, va_list _Args);
 #pragma warning(pop)
 }}}
 I.e. this functions declared as imported from DLL.

 But preprocessor replace such declarations and so we have our
 {{{avpriv_snprintf}}} function is declared as imported.

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2049#comment:5>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list