diff --git a/configure b/configure index 398f4c0651..218e51301a 100755 --- a/configure +++ b/configure @@ -2095,7 +2095,7 @@ msvc_flags(){ -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \ -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \ -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \ - -wd4996 ;; + -wd4996 -wd4273 ;; -std=c99) ;; -fno-math-errno) ;; -fno-common) ;; @@ -2761,6 +2761,25 @@ case $target_os in add_cppflags -U__STRICT_ANSI__ ;; win32|win64) + if enabled shared; then + # Link to the import library instead of the normal static library + # for shared libs. + LD_LIB='%.lib' + # Cannot build shared and static libraries at the same time with + # MSVC. + disable static + fi + shlibdir_default="$bindir_default" + SLIBPREF="" + SLIBSUF=".dll" + SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' + SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)' + SLIB_CREATE_DEF_CMD='makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)' + SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)' + SLIB_INSTALL_LINKS= + SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' + SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)' + SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)' objformat="win32" ranlib=: enable dos_paths diff --git a/libavcodec/ac3tab.h b/libavcodec/ac3tab.h index 8ed50520e6..c2b3febcb7 100644 --- a/libavcodec/ac3tab.h +++ b/libavcodec/ac3tab.h @@ -33,7 +33,7 @@ extern const uint16_t ff_ac3_frame_size_tab[38][3]; extern const uint8_t ff_ac3_channels_tab[8]; -extern const uint16_t avpriv_ac3_channel_layout_tab[8]; +extern av_export const uint16_t avpriv_ac3_channel_layout_tab[8]; extern const uint8_t ff_ac3_enc_channel_map[8][2][6]; extern const uint8_t ff_ac3_dec_channel_map[8][2][6]; extern const uint16_t ff_ac3_sample_rate_tab[3]; diff --git a/libavcodec/dca.h b/libavcodec/dca.h index 1515270471..76342f0ab9 100644 --- a/libavcodec/dca.h +++ b/libavcodec/dca.h @@ -26,6 +26,7 @@ #define AVCODEC_DCA_H #include +#include "libavutil/internal.h" /** DCA syncwords, also used for bitstream type detection */ #define DCA_MARKER_RAW_BE 0x7FFE8001 @@ -36,6 +37,6 @@ /** DCA-HD specific block starts with this marker. */ #define DCA_HD_MARKER 0x64582025 -extern const uint32_t avpriv_dca_sample_rates[16]; +extern av_export const uint32_t avpriv_dca_sample_rates[16]; #endif /* AVCODEC_DCA_H */ diff --git a/libavcodec/mjpeg.h b/libavcodec/mjpeg.h index 1374ab319f..a69b519184 100644 --- a/libavcodec/mjpeg.h +++ b/libavcodec/mjpeg.h @@ -137,16 +137,16 @@ static inline void put_marker(PutBitContext *p, int code) case 7: ret= (left + top)>>1; break;\ } -extern const uint8_t avpriv_mjpeg_bits_dc_luminance[]; -extern const uint8_t avpriv_mjpeg_val_dc[]; +extern av_export const uint8_t avpriv_mjpeg_bits_dc_luminance[]; +extern av_export const uint8_t avpriv_mjpeg_val_dc[]; -extern const uint8_t avpriv_mjpeg_bits_dc_chrominance[]; +extern av_export const uint8_t avpriv_mjpeg_bits_dc_chrominance[]; -extern const uint8_t avpriv_mjpeg_bits_ac_luminance[]; -extern const uint8_t avpriv_mjpeg_val_ac_luminance[]; +extern av_export const uint8_t avpriv_mjpeg_bits_ac_luminance[]; +extern av_export const uint8_t avpriv_mjpeg_val_ac_luminance[]; -extern const uint8_t avpriv_mjpeg_bits_ac_chrominance[]; -extern const uint8_t avpriv_mjpeg_val_ac_chrominance[]; +extern av_export const uint8_t avpriv_mjpeg_bits_ac_chrominance[]; +extern av_export const uint8_t avpriv_mjpeg_val_ac_chrominance[]; void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code, const uint8_t *bits_table, diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h index 1ee2d7e2c7..e71122d0d3 100644 --- a/libavcodec/mpeg4audio.h +++ b/libavcodec/mpeg4audio.h @@ -40,7 +40,7 @@ typedef struct MPEG4AudioConfig { int ps; ///< -1 implicit, 1 presence } MPEG4AudioConfig; -extern const int avpriv_mpeg4audio_sample_rates[16]; +extern av_export const int avpriv_mpeg4audio_sample_rates[16]; extern const uint8_t ff_mpeg4audio_channels[8]; /** diff --git a/libavcodec/mpegaudiodata.h b/libavcodec/mpegaudiodata.h index d1a8841f98..2b8ff6587f 100644 --- a/libavcodec/mpegaudiodata.h +++ b/libavcodec/mpegaudiodata.h @@ -29,11 +29,13 @@ #include +#include "libavutil/internal.h" + #define MODE_EXT_MS_STEREO 2 #define MODE_EXT_I_STEREO 1 -extern const uint16_t avpriv_mpa_bitrate_tab[2][3][15]; -extern const uint16_t avpriv_mpa_freq_tab[3]; +extern av_export const uint16_t avpriv_mpa_bitrate_tab[2][3][15]; +extern av_export const uint16_t avpriv_mpa_freq_tab[3]; extern const int ff_mpa_sblimit_table[5]; extern const int ff_mpa_quant_steps[17]; extern const int ff_mpa_quant_bits[17]; diff --git a/libavutil/internal.h b/libavutil/internal.h index e61a629f05..9fd105145c 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -47,6 +47,12 @@ #endif #endif +#if defined(_MSC_VER) && CONFIG_SHARED +# define av_export __declspec(dllimport) +#else +# define av_export +#endif + #ifndef INT_BIT # define INT_BIT (CHAR_BIT * sizeof(int)) #endif