[Ffmpeg-devel] mingw build is linking avcodec statically into avformat.dll

Alexander Strasser eclipse7
Wed Nov 16 10:09:26 CET 2005


Ronen Mizrahi wrote:
> I tried applying the patch and it looks like your Makefile was from a 
> different date than the one I had. I was using the CVS head from 
> yesterday and I though you were doing the same, were you not?

  I'm sorry. Updated patch attached.

  Alex (beastd)
-------------- next part --------------
Index: configure
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/configure,v
retrieving revision 1.215
diff -u -r1.215 configure
--- configure	22 Oct 2005 19:17:39 -0000	1.215
+++ configure	16 Nov 2005 08:40:27 -0000
@@ -1446,6 +1446,7 @@
   echo "#define HAVE_VHOOK 1" >> $TMPH
 fi
 if test "$lshared" = "yes" ; then
+  echo "#define BUILD_SHARED_AV 1" >> $TMPH
   echo "BUILD_SHARED=yes" >> config.mak
   echo "PIC=-fPIC -DPIC" >> config.mak
   echo "SPPMAJOR=0" >> config.mak
Index: libavcodec/Makefile
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/Makefile,v
retrieving revision 1.211
diff -u -r1.211 Makefile
--- libavcodec/Makefile	14 Nov 2005 22:17:29 -0000	1.211
+++ libavcodec/Makefile	16 Nov 2005 08:40:27 -0000
@@ -401,7 +401,7 @@
 	$(MAKE) -C libpostproc
 endif
 ifeq ($(CONFIG_WIN32),yes)
-	$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
+	$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def),--out-implib,$(LIB:.a=.dll.a) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
 	-lib /machine:i386 /def:$(@:.dll=.def)
 else
 	$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
@@ -424,7 +424,9 @@
 dep:	depend
 
 clean: $(CLEANAMR)
-	rm -f *.o *.d *~ .depend $(LIB) $(SLIBNAME) *$(SLIBSUF) i386/*.o i386/*~ \
+	rm -f *.o *.d *~ .depend $(LIB) $(SLIBNAME) *$(SLIBSUF) \
+	   *.lib *.def *.dll.a *.exp \
+	   i386/*.o i386/*~ \
 	   armv4l/*.o armv4l/*~ \
 	   mlib/*.o mlib/*~ \
 	   alpha/*.o alpha/*~ \
Index: libavformat/Makefile
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/Makefile,v
retrieving revision 1.102
diff -u -r1.102 Makefile
--- libavformat/Makefile	7 Nov 2005 01:32:29 -0000	1.102
+++ libavformat/Makefile	16 Nov 2005 08:40:27 -0000
@@ -98,7 +98,7 @@
 
 $(SLIBNAME): $(OBJS)
 ifeq ($(CONFIG_WIN32),yes)
-	$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(PPOBJS) $(AVCLIBS) $(EXTRALIBS)
+	$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def),--out-implib,$(LIB:.a=.dll.a) -o $@ $(OBJS) $(PPOBJS) $(AVCLIBS) $(EXTRALIBS)
 	-lib /machine:i386 /def:$(@:.dll=.def)
 else
 	$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(PPOBJS) $(AVCLIBS) $(EXTRALIBS)
@@ -141,7 +141,8 @@
 	g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $< 
 
 distclean clean: 
-	rm -f *.o *.d .depend *~ *.a *$(SLIBSUF) $(LIB)
+	rm -f *.o *.d .depend *~ *.a *$(SLIBSUF) $(LIB) \
+	      *.lib *.def *.dll.a *.exp
 
 #
 # include dependency files if they exist
Index: libavutil/Makefile
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavutil/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- libavutil/Makefile	7 Nov 2005 01:32:29 -0000	1.4
+++ libavutil/Makefile	16 Nov 2005 08:40:27 -0000
@@ -6,7 +6,7 @@
 VPATH=$(SRC_PATH)/libavutil
 
 # NOTE: -I.. is needed to include config.h
-CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
+CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -DBUILD_AVUTIL -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
 
 OBJS= mathematics.o \
       integer.o \
@@ -37,7 +37,7 @@
 
 $(SLIBNAME): $(OBJS)
 ifeq ($(CONFIG_WIN32),yes)
-	$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
+	$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def),--out-implib,$(LIB:.a=.dll.a) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
 	-lib /machine:i386 /def:$(@:.dll=.def)
 else
 	$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
@@ -52,7 +52,8 @@
 dep:	depend
 
 clean:
-	rm -f *.o *.d *~ .depend $(LIB) $(SLIBNAME) *$(SLIBSUF)
+	rm -f *.o *.d *~ .depend $(LIB) $(SLIBNAME) *$(SLIBSUF) \
+	      *.lib *.def *.dll.a *.exp
 
 distclean: clean
 	rm -f Makefile.bak .depend
Index: libavutil/common.h
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavutil/common.h,v
retrieving revision 1.153
diff -u -r1.153 common.h
--- libavutil/common.h	19 Sep 2005 23:26:47 -0000	1.153
+++ libavutil/common.h	16 Nov 2005 08:40:27 -0000
@@ -214,6 +214,13 @@
 
 #ifdef HAVE_AV_CONFIG_H
 
+#if defined(__MINGW32__) && !defined(BUILD_AVUTIL) && defined(BUILD_SHARED_AV)
+#  define FF_IMPORT_ATTR __declspec(dllimport)
+#else
+#  define FF_IMPORT_ATTR
+#endif
+
+
 #    include "bswap.h"
 
 // Use rip-relative addressing if compiling PIC code on x86-64.
@@ -309,7 +316,7 @@
 #endif
 
 /* misc math functions */
-extern const uint8_t ff_log2_tab[256];
+extern FF_IMPORT_ATTR const uint8_t ff_log2_tab[256];
 
 static inline int av_log2(unsigned int v)
 {
@@ -387,7 +394,7 @@
 }
 
 /* math */
-extern const uint8_t ff_sqrt_tab[128];
+extern FF_IMPORT_ATTR const uint8_t ff_sqrt_tab[128];
 
 int64_t ff_gcd(int64_t a, int64_t b);
 



More information about the ffmpeg-devel mailing list