[FFmpeg-devel] mingw64 4.7.x struct alignment behavior has changed

Hendrik Leppkes h.leppkes at gmail.com
Sat Jan 11 14:02:32 CET 2014

On Sat, Jan 11, 2014 at 1:09 PM, Reimar Döffinger
<Reimar.Doeffinger at gmx.de> wrote:
> On 10.01.2014, at 03:42, Timothy Gu <timothygu99 at gmail.com> wrote:
>> On Jan 9, 2014 6:53 PM, "Gianluigi Tiesi" <mplayer at netfarm.it> wrote:
>>> as stated in this announce:
>>> http://cygwin.com/ml/cygwin-announce/2013-07/msg00011.html
>>> For gcc-4.7.x, struct alignment behavior has changed, -mms-bitfields is
>>> now default for better MSVC compatibility. This may cause ABI changes
>>> in libraries that expose data structures directly to clients. Workaround
>>> include marking the struct with the gcc_struct attributes.
>> More technical details here:
>> http://gcc.gnu.org/onlinedocs/gccint/Storage-Layout.html#index-TARGET_005fMS_005fBITFIELD_005fLAYOUT_005fP-3938
>>> this actually breaks mplayer libmpdemux/asf.h structs
>>> e.g. ASF_stream_header_t is 56 bytes instead of 54
>>> I'm not sure about other places in mplayer and/or ffmpeg
>>> I'm not even sure for libraries I build for dependencies
>>> Should we add explicit gcc_struct or pass -mno-ms-bitfields to mingw?
>> I'd say to pass the compiler option to prevent corruption of source code,
>> if really necessary.
> You'd have to add it to the .pc files, too.
> IMO we should just make sure this option makes no difference.

Here is my arguments to simply keep it as is:

1) If i build the libs to link against a MSVC Windows App, this
Windows App will also interpret the public headers using the Microsoft
style, and therefor expect FFmpeg to do the same
2) If i build both libs and application using mingw64 on Windows, I'll
do it with the same version, and therefor struct alignment is also the

Considering these arguments, I would simply leave it.

Just my 2 cents.
- Hendrik

More information about the ffmpeg-devel mailing list