[FFmpeg-devel] [Patch] fix mingw/faac linking

Andrew Voznytsa andrew.voznytsa
Fri Sep 26 10:14:56 CEST 2008

<andrew.voznytsa at gmail.com> wrote:
> On Thu, Sep 25, 2008 at 9:38 PM, M?ns Rullg?rd <mans at mansr.com> wrote:
>>  "Andrew Voznytsa" <andrew.voznytsa at gmail.com> writes:
>> > Oops - patch attached. Sorry.
>> >
>> > Thanks,
>> >
>> > Andrew
>> >
>> >
>> > Index: libavcodec/libfaac.c
>> > ===================================================================
>> > --- libavcodec/libfaac.c      (revision 15413)
>> > +++ libavcodec/libfaac.c      (working copy)
>> > @@ -25,6 +25,11 @@
>> >   */
>> >
>> >  #include "avcodec.h"
>> > +
>> > +#ifdef __MINGW32__
>> > +#define WIN32
>> > +#endif
>> > +
>> Rejected.
> Reason?

#ifdef'ing a specific system is not a good idea, since the system
might change at some other point in time, and FFmpeg minimizes the use
of such ifdefs.

Besides, I never got any problem with libfaac failing to link. What
version are you using? Is it compiled with mingw as well?

OK, here are details:

gcc -v: Reading specs from d:/dev/mingw/bin/../lib/gcc/mingw32/3.4.5/specs
Configured with: ../gcc-3.4.5-20060117-3/configure --with-gcc --with-gnu-ld
th-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads
able-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry
isable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt
out-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter
e-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.5 (mingw-vista special r3)

faac: using latest cvs

faac and ffmpeg were built using the same compilier.

I'd note that it happened after I installed fresh 'current' mingw
(yesterdays version). Before that I used mingw with gcc 3.4.x for years
without any issues (I was able to build the same faac + ffmpeg rev13585).
Unfortunately my old mingw setup is not available anymore.

Just autoconf'ed and recompiled faac for sure and yes - API is stdcall
decorated _<function name>@<sizeof args> while during linking with ffmpeg ld
looks for cdecl names _<function name>.

faac.h says:

#ifdef WIN32
# ifndef FAACAPI
#  define FAACAPI __stdcall
# endif
# ifndef FAACAPI
#  define FAACAPI
# endif

BTW, WIN32 is defined in <mingw>/windef.h which is included by
<mingw>/windows.h which is included by lavf/os_support.h on ffmpeg side. How
WIN32 is defined on faac side - don't know, I don't see direct inclusion or

That's all info I've.


More information about the ffmpeg-devel mailing list