On Fri, 19 Jul 2013, Derek Buitenhuis wrote:

libx264 has a few data exports which require X264_API_IMPORTS
to be defined if we link to libx264 dynamically on Windows.

In a similar fashion to how we handle our compat snprintf
implementation, if we define it all the time, the
__declspec(dllimport) will be ignored by the compiler when it
isn't needed, and print a warning instead.

This section isn't quite accurate. The declaration is not ignored, but it means that the linker will end up trying to link to __imp_x264_symbol_name and not be able to find it, but will figure it out and do the right kind of magic to make it match the x264_symbol_name it does find (and warn about it). This magic only works if the object file that contains x264_symbol_name is included in the link earlier by some other symbol.


Signed-off-by: Derek Buitenhuis <[email protected]>
---
Tested on with MSVC 2012 and ICL 2013 XE.

Comments and flames welcome.
---
libavcodec/libx264.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index bb92110..665b31e 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -25,6 +25,11 @@
#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "internal.h"
+
+#if defined(_MSC_VER)
+#define X264_API_IMPORTS 1
+#endif
+
#include <x264.h>
#include <float.h>
#include <math.h>
--
1.8.3.2

The patch itself is ok with me, with the commit message clarified.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to