/INCREMENTAL:NO
is default for Release configuration in visual c.
I've downloaded FFmpeg git-3efe5e3 32-bit Dev
from http://ffmpeg.zeranoe.com/builds/ .
It contains .dll.a
and .lib
files. I chose .lib
. After compile the import tables for ffmpeg dlls are empty and the program crashes. If I enable /INCREMENTAL
, it compiles and runs fine.
test.c
:
void av_register_all();
int main() {
av_register_all();
return 0;
}
_
lib>cl test.c /link /incremental:no avformat.lib ws2_32.lib
lib>dumpbin /IMPORTS test.exe
...
avformat-55.dll
4080F4 Import Address Table
4095E4 Import Name Table
0 time date stamp
0 Index of first forwarder reference
KERNEL32.dll
408000 Import Address Table
4094F0 Import Name Table
0 time date stamp
0 Index of first forwarder reference
143 GetCurrentProcessId
110 GetCommandLineA
216 HeapFree
...
It is a known bug in
binutils
which is being used in Zeranoe builds of FFmpeg. In Release builds of Microsoft Visual Studio by default in Linker options > Optimization > References =/OPT:REF
which strips all FFmpeg references so you don't see them indumpbin /IMPORTS
.You need to follow instructions 4.2.1 Linking to FFmpeg with Microsoft Visual C++. There are two options. Either specify
/OPT:NOREF
in linker options which is not recommended due to increase of the size of an executable and increase initial loading time of an executable. Or generate new.lib
and.exp
files from.def
, for example, for x86_64:Another option is to build FFmpeg by youself.
Another option is to join FFmpeg dev community and move build system from autotools/autoconf/automake to CMake.
Moderators, please fix my broken english.