[FFmpeg-devel] [PATCH] Use _snprintf for mingw build

Zuxy Meng zuxy.meng
Mon Oct 15 06:51:16 CEST 2007


Hi,

2007/10/15, Fred Rothganger <fred at rothganger.org>:
> I am compiling ffmpeg under cygwin with -mno-cygwin, and then linking
> the resulting static libs under MSVC 2005 edition.  There are three
> symbols that remain undefined at link time:
>
> _snprintf
> _gettimeofday
> _round
>
> This patch addresses _snprintf.  The following two patches will address
> the other issues.  If someone knows of a better solution, please tell
> me.  Otherwise, please consider applying these patches.

I don't think MSVC is a supported platform. Furthermore MS's _snprintf
isn't the same as snprintf: the result of the former isn't guaranteed
to be zero terminated.

>
> Index: internal.h
> ===================================================================
> --- internal.h  (revision 10737)
> +++ internal.h  (working copy)
> @@ -259,6 +259,14 @@
>  #define fprintf please_use_av_log
>  #endif
>
> +
> +// Hack to rename certain standard C functions to link with MSVC runtime.
> +#if defined(__MINGW32__)

Actually MinGW runtime has provided a sane snprintf.

> +#undef  snprintf
> +#define snprintf _snprintf
> +#endif
> +
> +
>  #define CHECKED_ALLOCZ(p, size)\
>  {\
>     p= av_mallocz(size);\


-- 
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6




More information about the ffmpeg-devel mailing list