ffmpeg/libavutil
Martin Storsjö d66c52c2b3 Add support for building shared libraries with MSVC
This requires the makedef perl script by Derek, from the
c89-to-c99 repo. That scripts produces a .def file, listing
the symbols to be exported, based on the gcc version scripts
and the built object files.

To properly load non-function symbols from DLL files, the
data symbol declarations need to have the attribute
__declspec(dllimport) when building the calling code. (On mingw,
the linker can fix this up automatically, which is why it has not
been an issue so far. If this attribute is omitted, linking
actually succeeds, but reads from the table will not produce the
desired results at runtime.)

MSVC seems to manage to link DLLs (and run properly) even if
this attribute is present while building the library itself
(which normally isn't recommended) - other object files in the
same library manage to link to the symbol (with a small warning
at link time, like "warning LNK4049: locally defined symbol
_avpriv_mpa_bitrate_tab imported" - it doesn't seem to be possible
to squelch this warning), and the definition of the tables
themselves produce a warning that can be squelched ("warning C4273:
'avpriv_mpa_bitrate_tab' : inconsistent dll linkage, see previous
definition of 'avpriv_mpa_bitrate_tab').

In this setup, mingw isn't able to link object files that refer to
data symbols with __declspec(dllimport) without those symbols
actually being linked via a DLL (linking avcodec.dll ends up with
errors like "undefined reference to `__imp__avpriv_mpa_freq_tab'").
The dllimport declspec isn't needed at all in mingw, so we simply
choose not to declare it for other compilers than MSVC that requires
it. (If ICL support later requires it, the condition can be extended
later to include both of them.)

This also implies that code that is built to link to a certain
library as a DLL can't link to the same library as a static library.
Therefore, we only allow building either static or shared but not
both at the same time. (That is, static libraries as such can be,
and actually are, built - this is used for linking the test tools to
internal symbols in the libraries - but e.g. libavformat built to
link to libavcodec as a DLL cannot link statically to libavcodec.)

Also, linking to DLLs is slightly different from linking to shared
libraries on other platforms. DLLs use a thing called import
libraries, which is basically a stub library allowing the linker
to know which symbols exist in the DLL and what name the DLL will
have at runtime.

In mingw/gcc, the import library is usually named libfoo.dll.a,
which goes next to a static library named libfoo.a. This allows
gcc to pick the dynamic one, if available, from the normal -lfoo
switches, just as it does for libfoo.a vs libfoo.so on Unix. On
MSVC however, you need to literally specify the name of the import
library instead of the static library.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-10-18 14:26:15 +03:00
..
arm Move avutil tables only used in libavcodec to libavcodec. 2012-10-11 18:29:36 +02:00
avr32
bfin
mips mips: intreadwrite: fix inline asm for gcc 4.8 2012-05-09 13:45:22 +01:00
ppc float_dsp: ppc: add a separate header for Altivec function prototypes 2012-06-08 14:52:01 -04:00
sh4
tomi
x86 x86: get_cpu_flags: add necessary ifdefs around function body 2012-10-04 19:29:14 +02:00
adler32.c
adler32.h
aes.c avutil: Add functions for allocating opaque contexts for algorithms 2012-10-11 23:35:27 +03:00
aes.h avutil: Add functions for allocating opaque contexts for algorithms 2012-10-11 23:35:27 +03:00
attributes.h attributes: add av_noreturn 2012-07-03 17:26:51 +02:00
audio_fifo.c Don't include common.h from avutil.h 2012-08-15 22:32:06 +03:00
audio_fifo.h avutil: add audio fifo buffer 2012-04-20 09:43:11 -04:00
audioconvert.c lavu/audioconvert: add a second low frequency channel. 2012-09-12 18:26:53 -04:00
audioconvert.h lavu/audioconvert: add a second low frequency channel. 2012-09-12 18:26:53 -04:00
avassert.h
avstring.c avstring-test: fix memory leaks 2012-10-12 23:51:12 +01:00
avstring.h
avutil.h Don't include common.h from avutil.h 2012-08-15 22:32:06 +03:00
base64.c
base64.h
blowfish.c blowfish: Add more tests 2012-10-03 16:05:54 +03:00
blowfish.h Add Blowfish encryption support in libavutil 2012-07-04 15:10:57 +03:00
bswap.h
colorspace.h
common.h Move av_reverse table to libavcodec 2012-10-12 20:39:18 +02:00
cpu.c avopt: Store defaults for AV_OPT_TYPE_FLAGS in the i64 union member 2012-09-04 23:13:38 +03:00
cpu.h x86: build: replace mmx2 by mmxext 2012-08-03 22:51:05 +02:00
crc_data.h
crc.c
crc.h
des.c Use av_gettime() in various places 2012-06-20 17:09:03 +01:00
des.h
dict.c Don't include common.h from avutil.h 2012-08-15 22:32:06 +03:00
dict.h Give all anonymously typedeffed structs in headers a name 2012-10-06 09:27:11 +02:00
error.c Don't include common.h from avutil.h 2012-08-15 22:32:06 +03:00
error.h averror: make error values proper negative values 2012-10-11 01:07:57 +02:00
eval.c eval-test: make table static const 2012-10-13 11:39:25 +01:00
eval.h
fifo.c
fifo.h Don't include common.h from avutil.h 2012-08-15 22:32:06 +03:00
file.c Add some more missing includes after removing the implicit common.h 2012-08-15 23:48:48 +03:00
file.h Don't include common.h from avutil.h 2012-08-15 22:32:06 +03:00
float_dsp.c float_dsp: Move vector_fmac_scalar() from libavcodec to libavutil 2012-06-18 18:01:14 -04:00
float_dsp.h float_dsp: add x86-optimized functions for vector_fmac_scalar() 2012-06-18 18:01:14 -04:00
imgutils.c avutil: Rename ff_set_systematic_pal2() ---> avpriv_set_systematic_pal2() 2012-10-13 19:59:20 +02:00
imgutils.h avutil: Rename ff_set_systematic_pal2() ---> avpriv_set_systematic_pal2() 2012-10-13 19:59:20 +02:00
internal.h Add support for building shared libraries with MSVC 2012-10-18 14:26:15 +03:00
intfloat_readwrite.c
intfloat_readwrite.h
intfloat.h intfloat: Don't use designated initializers in the public headers 2012-07-02 14:05:40 +03:00
intmath.h Move avutil tables only used in libavcodec to libavcodec. 2012-10-11 18:29:36 +02:00
intreadwrite.h
lfg.c avformat: Remove non-compiling and/or silly commented-out printf/av_log statements 2012-10-01 10:24:28 +02:00
lfg.h Give all anonymously typedeffed structs in headers a name 2012-10-06 09:27:11 +02:00
libavutil.v avutil: Do not make ff_ symbols globally visible. 2012-10-13 20:01:56 +02:00
libm.h configure: Check for the math function rint 2012-07-11 10:40:11 +03:00
lls.c
lls.h
log2_tab.c avutil: Duplicate ff_log2_tab instead of sharing it across libs 2012-10-12 20:39:17 +02:00
log.c Don't include common.h from avutil.h 2012-08-15 22:32:06 +03:00
log.h
lzo.c
lzo.h
Makefile build: simplify enabling of compat objects 2012-10-15 17:46:19 +01:00
mathematics.c Move av_reverse table to libavcodec 2012-10-12 20:39:18 +02:00
mathematics.h mathematics: Don't use division by zero in NAN/INFINITY macros 2012-07-01 19:06:13 +03:00
md5.c avutil: Add functions for allocating opaque contexts for algorithms 2012-10-11 23:35:27 +03:00
md5.h avutil: Add functions for allocating opaque contexts for algorithms 2012-10-11 23:35:27 +03:00
mem.c mem: Don't abort on av_malloc(0) in debug mode 2012-07-10 11:37:03 +03:00
mem.h mem: fix typo in check for __ICC 2012-09-10 00:07:26 +01:00
old_pix_fmts.h pixfmt: add AV_ prefixes to PIX_FMT_* 2012-10-08 07:12:16 +02:00
opt.c avopt: Explicitly store rational option defaults in .dbl 2012-09-04 23:13:55 +03:00
opt.h avopt: fix examples to match the same style about default values as the actual code. 2012-09-05 20:09:47 +03:00
parseutils.c parseutils-test: various cleanups 2012-10-11 18:00:27 +01:00
parseutils.h
pixdesc.c avutil: add yuva422p and yuva444p formats 2012-10-12 15:09:51 +02:00
pixdesc.h pixdesc: add functions for accessing pixel format descriptors. 2012-10-12 12:45:25 +02:00
pixfmt.h avutil: add yuva422p and yuva444p formats 2012-10-12 15:09:51 +02:00
random_seed.c random_seed: Support using CryptGenRandom on windows 2012-10-11 18:49:34 +03:00
random_seed.h
rational.c
rational.h rational: add av_inv_q() returning the inverse of an AVRational 2012-08-05 17:46:41 +01:00
rc4.c
rc4.h
samplefmt.c samplefmt: make av_samples_alloc() initialize the data to silence. 2012-10-04 08:05:21 +02:00
samplefmt.h samplefmt: make av_samples_alloc() initialize the data to silence. 2012-10-04 08:05:21 +02:00
sha.c avutil: Add functions for allocating opaque contexts for algorithms 2012-10-11 23:35:27 +03:00
sha.h avutil: Add functions for allocating opaque contexts for algorithms 2012-10-11 23:35:27 +03:00
time.c lavu: add av_usleep() function 2012-06-22 17:15:18 +01:00
time.h lavu: add av_usleep() function 2012-06-22 17:15:18 +01:00
timer.h Don't include common.h from avutil.h 2012-08-15 22:32:06 +03:00
tree.c Use the new aes/md5/sha/tree allocation functions 2012-10-11 23:35:28 +03:00
tree.h avutil: Add functions for allocating opaque contexts for algorithms 2012-10-11 23:35:27 +03:00
utils.c
version.h Move av_reverse table to libavcodec 2012-10-12 20:39:18 +02:00
xtea.c xtea: Test inplace decryption 2012-10-03 19:19:53 +03:00
xtea.h doxygen: Fix function parameter names to match the code 2012-08-09 20:05:55 +02:00