]> git.sesse.net Git - ffmpeg/commitdiff
libavutil: Make avpriv_open a library-internal function on msvcrt
authorMartin Storsjö <martin@martin.st>
Fri, 9 Aug 2013 08:06:46 +0000 (11:06 +0300)
committerMartin Storsjö <martin@martin.st>
Fri, 9 Aug 2013 21:53:33 +0000 (00:53 +0300)
Add one copy of the function into each of the libraries, similarly
to what we do for log2_tab. When using static libs, only one
copy of the file_open.o object file gets included, while when
using shared libraries, each of them get a copy of its own.

This fixes DLL builds with a statically linked C runtime, where
each DLL effectively has got its own instance of the C runtime,
where file descriptors can't be shared across runtimes.

On systems not using msvcrt, the function is not duplicated.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavcodec/Makefile
libavcodec/file_open.c [new file with mode: 0644]
libavdevice/Makefile
libavdevice/file_open.c [new file with mode: 0644]
libavformat/Makefile
libavformat/file_open.c [new file with mode: 0644]
libavutil/internal.h

index fc1bfb23527a9d194299b781e34357cabbdf4ba6..318ed7db2af093d6e859bd2121a123924943a847 100644 (file)
@@ -26,6 +26,8 @@ OBJS = allcodecs.o                                                      \
        raw.o                                                            \
        utils.o                                                          \
 
+OBJS-$(HAVE_MSVCRT) += file_open.o
+
 # parts needed for many different codecs
 OBJS-$(CONFIG_AANDCTTABLES)            += aandcttab.o
 OBJS-$(CONFIG_AC3DSP)                  += ac3dsp.o
diff --git a/libavcodec/file_open.c b/libavcodec/file_open.c
new file mode 100644 (file)
index 0000000..494a5d3
--- /dev/null
@@ -0,0 +1 @@
+#include "libavutil/file_open.c"
index 76d11c1f1c73ffda893024c4bf136c896f2f2fc4..8fdae2d44e1b4c36079f564bfbbf91ed4c8968eb 100644 (file)
@@ -7,6 +7,8 @@ HEADERS = avdevice.h                                                    \
 OBJS    = alldevices.o                                                  \
           avdevice.o                                                    \
 
+OBJS-$(HAVE_MSVCRT) += file_open.o
+
 # input/output devices
 OBJS-$(CONFIG_ALSA_INDEV)                += alsa-audio-common.o \
                                             alsa-audio-dec.o
diff --git a/libavdevice/file_open.c b/libavdevice/file_open.c
new file mode 100644 (file)
index 0000000..494a5d3
--- /dev/null
@@ -0,0 +1 @@
+#include "libavutil/file_open.c"
index 5e2dd2a5408905e683e52d75cfe97fece804fcb9..0b788c94c47a9e7169a5b7c362f197c2293e0f4c 100644 (file)
@@ -23,6 +23,8 @@ OBJS = allformats.o         \
        url.o                \
        utils.o              \
 
+OBJS-$(HAVE_MSVCRT) += file_open.o
+
 OBJS-$(CONFIG_NETWORK)                   += network.o
 OBJS-$(CONFIG_RIFFDEC)                   += riffdec.o
 OBJS-$(CONFIG_RIFFENC)                   += riffenc.o
diff --git a/libavformat/file_open.c b/libavformat/file_open.c
new file mode 100644 (file)
index 0000000..494a5d3
--- /dev/null
@@ -0,0 +1 @@
+#include "libavutil/file_open.c"
index 355a42a7b47ba5bc317e50e74a76dcd441cc75f0..b18860f08441ecaea983e7be54141304cd737a66 100644 (file)
@@ -196,6 +196,10 @@ void avpriv_report_missing_feature(void *avc,
 void avpriv_request_sample(void *avc,
                            const char *msg, ...) av_printf_format(2, 3);
 
+#if HAVE_MSVCRT
+#define avpriv_open ff_open
+#endif
+
 /**
  * A wrapper for open() setting O_CLOEXEC.
  */