Pragma pack again (32-bit Windows)

Hi guys,

I’ve asked this question some time ago, and saw that packing has been
fixed for 64-bit, but I still think it should be fixed for the 32-bit
case. Even better, remove #pragma pack(push,xx) / pragma pack(pop) at
all, this way letting the default behavior rule, which hopefully would
make different compiler more happy to play with each other.

/* Force structure packing at 4 byte alignment.
This is necessary if the header is included in code which has structure
packing set to an alternate value, say for loading structures from disk.
The packing is reset to the previous value in close_code.h
/
#if defined(_MSC_VER) || defined(MWERKS) || defined(BORLANDC)
#ifdef _MSC_VER
#pragma warning(disable: 4103)
#endif
#ifdef BORLANDC
#pragma nopackwarning
#endif
#ifdef _M_X64
/
Use 8-byte alignment on 64-bit architectures, so pointers are aligned /
#pragma pack(push,8)
#else
#pragma pack(push,4)
#endif
#endif /
Compiler needs structure packing set */

More specifically the fact that pragma packing is done only for
_MSC_VER, MWERKS, BORLANDC, but not for mingw/cygwin or others.

The problem here is that one cannot mix an sdl.dll produced by one
compiler with another.

The bigger problem, is that it’s hard for FFI bindings to any language
to communicate directly the packings, as the FFI binding don’t know what
DLL is going to be loaded.

For 64-bit we are fine now, as pack(push,8) is the default for MSVC
compilers.

but for 32-bit, the default is again 8 /Zp8 - e.g. pack(push,8) not 4

http://msdn.microsoft.com/en-us/library/2e70t5y1(v=vs.80).aspx
http://msdn.microsoft.com/en-us/library/2e70t5y1(v=VS.90).aspx
http://msdn.microsoft.com/en-us/library/2e70t5y1(v=VS.100).aspx

I still don’t see the need for such packing, there is one case (by just
looking for the double type, where some minor degration might be
happening). The “rate_incr” would get aligned to the 16-byte in the
non-MSVC compiler, and 12-byte with MSVC. There is also the len_ratio,
but haven’t checked what it’s going to be.

typedef struct SDL_AudioCVT
{
int needed; /< Set to 1 if conversion possible */
SDL_AudioFormat src_format; /
< Source audio format */
SDL_AudioFormat dst_format; /< Target audio format */
double rate_incr; /
< Rate conversion increment */
Uint8 *buf; /< Buffer to hold entire audio data */
int len; /
< Length of original audio buffer /
int len_cvt; /< Length of converted audio buffer */
int len_mult; /
< buffer must be len
len_mult big /
double len_ratio; /**< Given len, final size is
len
len_ratio */
SDL_AudioFilter filters[10]; /< Filter list */
int filter_index; /
< Current audio conversion function */
} SDL_AudioCVT;

Alternatively if these pragma packs need to be kept, then maybe the
SDL_AudioCVT structure might have to be padded, so that it’s binary
compatible with different SDL.dll’s compiled from different compilers.

I have a luajit FFI library bindings -
https://github.com/malkia/ufo/blob/master/ffi/sdl.lua and so far I’ve
been manually patching begin_code.h/end_code.h to not have the pragma
packs, but this means I can’t reuse my code with different SDL.dll (or
someone else).

Thanks,
Dimiter ‘malkia’ Stanev.

I feel like we’ve already gone through this…On Mon, Jan 9, 2012 at 9:08 PM, Dimiter ‘malkia’ Stanev wrote:

Hi guys,

I’ve asked this question some time ago, and saw that packing has been
fixed for 64-bit, but I still think it should be fixed for the 32-bit case.
Even better, remove #pragma pack(push,xx) / pragma pack(pop) at all, this
way letting the default behavior rule, which hopefully would make different
compiler more happy to play with each other.

It won’t help. Let’s say my compiler “FooCC” padded structures to the 8th
byte unless explicitly told not to. Then, if I saw this structure:

struct foo {
double x
int y;
}

sizeof(foo) would be 16. On a compiler like MinGW, it would be 12 bytes. If
I used “FooCC” to compile this DLL, and had memset(&structure, 0,
sizeof(struct foo)); it would set 16 bytes to 0. This would trash 4 bytes
if the function was called by a C program that was compiled by MinGW. How
does this help? Packing allows compilers to AGREE on a common scheme to
ensure structures are binary-compatible with each other. To summarize:

SDL.dll (compiled with FooCC)

void function(struct foo* f) {
memset(f, 0, sizeof(struct foo));
}


MyProgram.exe (compiled with MinGW)

int main() {
int a = 0x11223344;
struct foo f;
int b = 0xAABBCCDD;

function(&f); //call into DLL compiled with “FooCC”

//stack is corrupt. Values of ‘a’ or ‘b’ might be 0

}

/* Force structure packing at 4 byte alignment.
This is necessary if the header is included in code which has structure
packing set to an alternate value, say for loading structures from disk.
The packing is reset to the previous value in close_code.h
/
#if defined(_MSC_VER) || defined(MWERKS) || defined(BORLANDC)
#ifdef _MSC_VER
#pragma warning(disable: 4103)
#endif
#ifdef BORLANDC
#pragma nopackwarning
#endif
#ifdef _M_X64
/
Use 8-byte alignment on 64-bit architectures, so pointers are aligned /
#pragma pack(push,8)
#else
#pragma pack(push,4)
#endif
#endif /
Compiler needs structure packing set */

More specifically the fact that pragma packing is done only for _MSC_VER,
MWERKS, BORLANDC, but not for mingw/cygwin or others.

Then patch it? GCC supports #pragma pack (
http://gcc.gnu.org/onlinedocs/gcc/Structure_002dPacking-Pragmas.html)

#if defined(_MSC_VER) || defined(MWERKS) || defined(BORLANDC) || *
defined(GNUC)*

The problem here is that one cannot mix an sdl.dll produced by one compiler

with another.

The bigger problem, is that it’s hard for FFI bindings to any language to
communicate directly the packings, as the FFI binding don’t know what DLL
is going to be loaded.

Isn’t it!? See above about ensuring binary compatability between compilers.
This is the perfect the use-case FOR structure padding!

For 64-bit we are fine now, as pack(push,8) is the default for MSVC
compilers.

but for 32-bit, the default is again 8 /Zp8 - e.g. pack(push,8) not 4

http://msdn.microsoft.com/en-**us/library/2e70t5y1(v=vs.80).**aspxhttp://msdn.microsoft.com/en-us/library/2e70t5y1(v=vs.80).aspx
http://msdn.microsoft.com/en-**us/library/2e70t5y1(v=VS.90).**aspxhttp://msdn.microsoft.com/en-us/library/2e70t5y1(v=VS.90).aspx
http://msdn.microsoft.com/en-**us/library/2e70t5y1(v=VS.100).**aspxhttp://msdn.microsoft.com/en-us/library/2e70t5y1(v=VS.100).aspx

I still don’t see the need for such packing, there is one case (by just
looking for the double type, where some minor degration might be
happening). The “rate_incr” would get aligned to the 16-byte in the
non-MSVC compiler, and 12-byte with MSVC. There is also the len_ratio, but
haven’t checked what it’s going to be.

typedef struct SDL_AudioCVT
{
int needed; /< Set to 1 if conversion possible */
SDL_AudioFormat src_format; /
< Source audio format */
SDL_AudioFormat dst_format; /< Target audio format */
double rate_incr; /
< Rate conversion increment */
Uint8 *buf; /< Buffer to hold entire audio data */
int len; /
< Length of original audio buffer /
int len_cvt; /< Length of converted audio buffer */
int len_mult; /
< buffer must be len
len_mult big /
double len_ratio; /**< Given len, final size is len
len_ratio
*/
SDL_AudioFilter filters[10]; /< Filter list */
int filter_index; /
< Current audio conversion function */
} SDL_AudioCVT;

Alternatively if these pragma packs need to be kept, then maybe the
SDL_AudioCVT structure might have to be padded, so that it’s binary
compatible with different SDL.dll’s compiled from different compilers.

I have a luajit FFI library bindings - https://github.com/malkia/ufo/**
blob/master/ffi/sdl.luahttps://github.com/malkia/ufo/blob/master/ffi/sdl.luaand so far I’ve been manually patching begin_code.h/end_code.h to not have
the pragma packs, but this means I can’t reuse my code with different
SDL.dll (or someone else).

Thanks,
Dimiter ‘malkia’ Stanev.
_____________**
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/**listinfo.cgi/sdl-libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yeah, my first instinct was to add gcc to the pragma pack list, but I know
that gcc hasn’t always supported it and I realized that 8-byte alignment
makes a lot of sense on 64-bit architectures. If somebody wants to track
down what the version check should be for gcc pragma pack(push/pop), I’ll
definitely add that for compiler consistency.

Cheers!On Tue, Jan 10, 2012 at 10:27 AM, Patrick Baggett <baggett.patrick at gmail.com wrote:

I feel like we’ve already gone through this…

On Mon, Jan 9, 2012 at 9:08 PM, Dimiter ‘malkia’ Stanev wrote:

Hi guys,

I’ve asked this question some time ago, and saw that packing has been
fixed for 64-bit, but I still think it should be fixed for the 32-bit case.
Even better, remove #pragma pack(push,xx) / pragma pack(pop) at all, this
way letting the default behavior rule, which hopefully would make different
compiler more happy to play with each other.

It won’t help. Let’s say my compiler “FooCC” padded structures to the 8th
byte unless explicitly told not to. Then, if I saw this structure:

struct foo {
double x
int y;
}

sizeof(foo) would be 16. On a compiler like MinGW, it would be 12 bytes.
If I used “FooCC” to compile this DLL, and had memset(&structure, 0,
sizeof(struct foo)); it would set 16 bytes to 0. This would trash 4 bytes
if the function was called by a C program that was compiled by MinGW. How
does this help? Packing allows compilers to AGREE on a common scheme to
ensure structures are binary-compatible with each other. To summarize:

SDL.dll (compiled with FooCC)

void function(struct foo* f) {
memset(f, 0, sizeof(struct foo));
}


MyProgram.exe (compiled with MinGW)

int main() {
int a = 0x11223344;
struct foo f;
int b = 0xAABBCCDD;

function(&f); //call into DLL compiled with “FooCC”

//stack is corrupt. Values of ‘a’ or ‘b’ might be 0

}

/* Force structure packing at 4 byte alignment.
This is necessary if the header is included in code which has structure
packing set to an alternate value, say for loading structures from disk.
The packing is reset to the previous value in close_code.h
/
#if defined(_MSC_VER) || defined(MWERKS) || defined(BORLANDC)
#ifdef _MSC_VER
#pragma warning(disable: 4103)
#endif
#ifdef BORLANDC
#pragma nopackwarning
#endif
#ifdef _M_X64
/
Use 8-byte alignment on 64-bit architectures, so pointers are aligned
/
#pragma pack(push,8)
#else
#pragma pack(push,4)
#endif
#endif /
Compiler needs structure packing set */

More specifically the fact that pragma packing is done only for _MSC_VER,
MWERKS, BORLANDC, but not for mingw/cygwin or others.

Then patch it? GCC supports #pragma pack (
http://gcc.gnu.org/onlinedocs/gcc/Structure_002dPacking-Pragmas.html)

#if defined(_MSC_VER) || defined(MWERKS) || defined(BORLANDC) || *
defined(GNUC)*

The problem here is that one cannot mix an sdl.dll produced by one

compiler with another.

The bigger problem, is that it’s hard for FFI bindings to any language to
communicate directly the packings, as the FFI binding don’t know what DLL
is going to be loaded.

Isn’t it!? See above about ensuring binary compatability between
compilers. This is the perfect the use-case FOR structure padding!

For 64-bit we are fine now, as pack(push,8) is the default for MSVC
compilers.

but for 32-bit, the default is again 8 /Zp8 - e.g. pack(push,8) not 4

http://msdn.microsoft.com/en-**us/library/2e70t5y1(v=vs.80).**aspxhttp://msdn.microsoft.com/en-us/library/2e70t5y1(v=vs.80).aspx
http://msdn.microsoft.com/en-**us/library/2e70t5y1(v=VS.90).**aspxhttp://msdn.microsoft.com/en-us/library/2e70t5y1(v=VS.90).aspx
http://msdn.microsoft.com/en-**us/library/2e70t5y1(v=VS.100).**aspxhttp://msdn.microsoft.com/en-us/library/2e70t5y1(v=VS.100).aspx

I still don’t see the need for such packing, there is one case (by just
looking for the double type, where some minor degration might be
happening). The “rate_incr” would get aligned to the 16-byte in the
non-MSVC compiler, and 12-byte with MSVC. There is also the len_ratio, but
haven’t checked what it’s going to be.

typedef struct SDL_AudioCVT
{
int needed; /< Set to 1 if conversion possible */
SDL_AudioFormat src_format; /
< Source audio format */
SDL_AudioFormat dst_format; /< Target audio format */
double rate_incr; /
< Rate conversion increment */
Uint8 *buf; /< Buffer to hold entire audio data */
int len; /
< Length of original audio buffer /
int len_cvt; /< Length of converted audio buffer */
int len_mult; /
< buffer must be len
len_mult big /
double len_ratio; /**< Given len, final size is
len
len_ratio */
SDL_AudioFilter filters[10]; /< Filter list */
int filter_index; /
< Current audio conversion function */
} SDL_AudioCVT;

Alternatively if these pragma packs need to be kept, then maybe the
SDL_AudioCVT structure might have to be padded, so that it’s binary
compatible with different SDL.dll’s compiled from different compilers.

I have a luajit FFI library bindings - https://github.com/malkia/ufo/**
blob/master/ffi/sdl.luahttps://github.com/malkia/ufo/blob/master/ffi/sdl.luaand so far I’ve been manually patching begin_code.h/end_code.h to not have
the pragma packs, but this means I can’t reuse my code with different
SDL.dll (or someone else).

Thanks,
Dimiter ‘malkia’ Stanev.
_____________**
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/**listinfo.cgi/sdl-libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I know GCC > 3.4 will do it, and that seems old enough…On Tue, Jan 10, 2012 at 9:57 AM, Sam Lantinga wrote:

Yeah, my first instinct was to add gcc to the pragma pack list, but I know
that gcc hasn’t always supported it and I realized that 8-byte alignment
makes a lot of sense on 64-bit architectures. If somebody wants to track
down what the version check should be for gcc pragma pack(push/pop), I’ll
definitely add that for compiler consistency.

Cheers!

On Tue, Jan 10, 2012 at 10:27 AM, Patrick Baggett < @Patrick_Baggett> wrote:

I feel like we’ve already gone through this…

On Mon, Jan 9, 2012 at 9:08 PM, Dimiter ‘malkia’ Stanev <malkia at gmail.com wrote:

Hi guys,

I’ve asked this question some time ago, and saw that packing has been
fixed for 64-bit, but I still think it should be fixed for the 32-bit case.
Even better, remove #pragma pack(push,xx) / pragma pack(pop) at all, this
way letting the default behavior rule, which hopefully would make different
compiler more happy to play with each other.

It won’t help. Let’s say my compiler “FooCC” padded structures to the
8th byte unless explicitly told not to. Then, if I saw this structure:

struct foo {
double x
int y;
}

sizeof(foo) would be 16. On a compiler like MinGW, it would be 12 bytes.
If I used “FooCC” to compile this DLL, and had memset(&structure, 0,
sizeof(struct foo)); it would set 16 bytes to 0. This would trash 4 bytes
if the function was called by a C program that was compiled by MinGW. How
does this help? Packing allows compilers to AGREE on a common scheme to
ensure structures are binary-compatible with each other. To summarize:

SDL.dll (compiled with FooCC)

void function(struct foo* f) {
memset(f, 0, sizeof(struct foo));
}


MyProgram.exe (compiled with MinGW)

int main() {
int a = 0x11223344;
struct foo f;
int b = 0xAABBCCDD;

function(&f); //call into DLL compiled with “FooCC”

//stack is corrupt. Values of ‘a’ or ‘b’ might be 0

}

/* Force structure packing at 4 byte alignment.
This is necessary if the header is included in code which has structure
packing set to an alternate value, say for loading structures from
disk.
The packing is reset to the previous value in close_code.h
/
#if defined(_MSC_VER) || defined(MWERKS) || defined(BORLANDC)
#ifdef _MSC_VER
#pragma warning(disable: 4103)
#endif
#ifdef BORLANDC
#pragma nopackwarning
#endif
#ifdef _M_X64
/
Use 8-byte alignment on 64-bit architectures, so pointers are aligned
/
#pragma pack(push,8)
#else
#pragma pack(push,4)
#endif
#endif /
Compiler needs structure packing set */

More specifically the fact that pragma packing is done only for
_MSC_VER, MWERKS, BORLANDC, but not for mingw/cygwin or others.

Then patch it? GCC supports #pragma pack (
http://gcc.gnu.org/onlinedocs/gcc/Structure_002dPacking-Pragmas.html)

#if defined(_MSC_VER) || defined(MWERKS) || defined(BORLANDC) ||
defined(GNUC)

The problem here is that one cannot mix an sdl.dll produced by one

compiler with another.

The bigger problem, is that it’s hard for FFI bindings to any language
to communicate directly the packings, as the FFI binding don’t know what
DLL is going to be loaded.

Isn’t it!? See above about ensuring binary compatability between
compilers. This is the perfect the use-case FOR structure padding!

For 64-bit we are fine now, as pack(push,8) is the default for MSVC
compilers.

but for 32-bit, the default is again 8 /Zp8 - e.g. pack(push,8) not 4

http://msdn.microsoft.com/en-**us/library/2e70t5y1(v=vs.80).**aspxhttp://msdn.microsoft.com/en-us/library/2e70t5y1(v=vs.80).aspx
http://msdn.microsoft.com/en-**us/library/2e70t5y1(v=VS.90).**aspxhttp://msdn.microsoft.com/en-us/library/2e70t5y1(v=VS.90).aspx
http://msdn.microsoft.com/en-**us/library/2e70t5y1(v=VS.100).**aspxhttp://msdn.microsoft.com/en-us/library/2e70t5y1(v=VS.100).aspx

I still don’t see the need for such packing, there is one case (by just
looking for the double type, where some minor degration might be
happening). The “rate_incr” would get aligned to the 16-byte in the
non-MSVC compiler, and 12-byte with MSVC. There is also the len_ratio, but
haven’t checked what it’s going to be.

typedef struct SDL_AudioCVT
{
int needed; /< Set to 1 if conversion possible */
SDL_AudioFormat src_format; /
< Source audio format */
SDL_AudioFormat dst_format; /< Target audio format */
double rate_incr; /
< Rate conversion increment */
Uint8 *buf; /< Buffer to hold entire audio data */
int len; /
< Length of original audio buffer /
int len_cvt; /< Length of converted audio buffer */
int len_mult; /
< buffer must be len
len_mult big /
double len_ratio; /**< Given len, final size is
len
len_ratio */
SDL_AudioFilter filters[10]; /< Filter list */
int filter_index; /
< Current audio conversion function */
} SDL_AudioCVT;

Alternatively if these pragma packs need to be kept, then maybe the
SDL_AudioCVT structure might have to be padded, so that it’s binary
compatible with different SDL.dll’s compiled from different compilers.

I have a luajit FFI library bindings - https://github.com/malkia/ufo/**
blob/master/ffi/sdl.luahttps://github.com/malkia/ufo/blob/master/ffi/sdl.luaand so far I’ve been manually patching begin_code.h/end_code.h to not have
the pragma packs, but this means I can’t reuse my code with different
SDL.dll (or someone else).

Thanks,
Dimiter ‘malkia’ Stanev.
_____________**
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/**listinfo.cgi/sdl-libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Thank you guys!

Having packing for gcc (mingw/cygwin) would definitely help.On 1/10/2012 8:01 AM, Patrick Baggett wrote:

I know GCC > 3.4 will do it, and that seems old enough…

On Tue, Jan 10, 2012 at 9:57 AM, Sam Lantinga <slouken at libsdl.org <mailto:slouken at libsdl.org>> wrote:

Yeah, my first instinct was to add gcc to the pragma pack list, but
I know that gcc hasn't always supported it and I realized that
8-byte alignment makes a lot of sense on 64-bit architectures.  If
somebody wants to track down what the version check should be for
gcc pragma pack(push/pop), I'll definitely add that for compiler
consistency.

Cheers!


On Tue, Jan 10, 2012 at 10:27 AM, Patrick Baggett <baggett.patrick at gmail.com <mailto:baggett.patrick at gmail.com>> wrote:

    I feel like we've already gone through this...

    On Mon, Jan 9, 2012 at 9:08 PM, Dimiter 'malkia' Stanev <@Dimiter_malkia_Stane <mailto:@Dimiter_malkia_Stane>> wrote:

        Hi guys,

        I've asked this question some time ago, and saw that packing
        has been fixed for 64-bit, but I still think it should be
        fixed for the 32-bit case. Even better, remove #pragma
        pack(push,xx) / pragma pack(pop) at all, this way letting
        the default behavior rule, which hopefully would make
        different compiler more happy to play with each other.

    It won't help. Let's say my compiler "FooCC" padded structures
    to the 8th byte unless explicitly told not to. Then, if I saw
    this structure:

    struct foo {
    double x
    int y;
    }

    sizeof(foo) would be 16. On a compiler like MinGW, it would be
    12 bytes. If I used "FooCC" to compile this DLL, and had
    memset(&structure, 0, sizeof(struct foo)); it would set 16 bytes
    to 0. This would trash 4 bytes if the function was called by a C
    program that was compiled by MinGW. How does this help? Packing
    allows compilers to AGREE on a common scheme to ensure
    structures are binary-compatible with each other. To summarize:

    SDL.dll (compiled with FooCC)

    void function(struct foo* f) {
    memset(f, 0, sizeof(struct foo));
    }

    ---
    MyProgram.exe (compiled with MinGW)

    int main() {
    int a = 0x11223344;
    struct foo f;
    int b = 0xAABBCCDD;

    function(&f); //call into DLL compiled with "FooCC"

    //stack is corrupt. Values of 'a' or 'b' might be 0

    }

        /* Force structure packing at 4 byte alignment.
           This is necessary if the header is included in code which
        has structure
           packing set to an alternate value, say for loading
        structures from disk.
           The packing is reset to the previous value in close_code.h
          */
        #if defined(_MSC_VER) || defined(__MWERKS__) ||
        defined(__BORLANDC__)
        #ifdef _MSC_VER
        #pragma warning(disable: 4103)
        #endif
        #ifdef __BORLANDC__
        #pragma nopackwarning
        #endif
        #ifdef _M_X64
        /* Use 8-byte alignment on 64-bit architectures, so pointers
        are aligned */
        #pragma pack(push,8)
        #else
        #pragma pack(push,4)
        #endif
        #endif /* Compiler needs structure packing set */

        More specifically the fact that pragma packing is done only
        for _MSC_VER, __MWERKS__, __BORLANDC__, but not for
        mingw/cygwin or others.

    Then patch it? GCC supports #pragma pack
    (http://gcc.gnu.org/onlinedocs/gcc/Structure_002dPacking-Pragmas.html)

    #if defined(_MSC_VER) || defined(__MWERKS__) ||
    defined(__BORLANDC__) || *defined(__GNUC__)*

        The problem here is that one cannot mix an sdl.dll produced
        by one compiler with another.

        The bigger problem, is that it's hard for FFI bindings to
        any language to communicate directly the packings, as the
        FFI binding don't know what DLL is going to be loaded.


    Isn't it!? See above about ensuring binary compatability between
    compilers. *This is the perfect the use-case FOR structure padding!*

        For 64-bit we are fine now, as pack(push,8) is the default
        for MSVC compilers.

        but for 32-bit, the default is again 8 /Zp8 - e.g.
        pack(push,8) not 4

        http://msdn.microsoft.com/en-__us/library/2e70t5y1(v=vs.80).__aspx
        <http://msdn.microsoft.com/en-us/library/2e70t5y1%28v=vs.80%29.aspx>
        http://msdn.microsoft.com/en-__us/library/2e70t5y1(v=VS.90).__aspx
        <http://msdn.microsoft.com/en-us/library/2e70t5y1%28v=VS.90%29.aspx>
        http://msdn.microsoft.com/en-__us/library/2e70t5y1(v=VS.100).__aspx
        <http://msdn.microsoft.com/en-us/library/2e70t5y1%28v=VS.100%29.aspx>

        I still don't see the need for such packing, there is one
        case (by just looking for the double type, where some minor
        degration might be happening). The "rate_incr" would get
        aligned to the 16-byte in the non-MSVC compiler, and 12-byte
        with MSVC. There is also the len_ratio, but haven't checked
        what it's going to be.

        typedef struct SDL_AudioCVT
        {
            int needed;                 /**< Set to 1 if conversion
        possible */
            SDL_AudioFormat src_format; /**< Source audio format */
            SDL_AudioFormat dst_format; /**< Target audio format */
            double rate_incr;           /**< Rate conversion
        increment */
            Uint8 *buf;                 /**< Buffer to hold entire
        audio data */
            int len;                    /**< Length of original
        audio buffer */
            int len_cvt;                /**< Length of converted
        audio buffer */
            int len_mult;               /**< buffer must be
        len*len_mult big */
            double len_ratio;           /**< Given len, final size
        is len*len_ratio */
            SDL_AudioFilter filters[10];        /**< Filter list */
            int filter_index;           /**< Current audio
        conversion function */
        } SDL_AudioCVT;

        Alternatively if these pragma packs need to be kept, then
        maybe the SDL_AudioCVT structure might have to be padded, so
        that it's binary compatible with different SDL.dll's
        compiled from different compilers.

        I have a luajit FFI library bindings -
        https://github.com/malkia/ufo/__blob/master/ffi/sdl.lua
        <https://github.com/malkia/ufo/blob/master/ffi/sdl.lua> and
        so far I've been manually patching begin_code.h/end_code.h
        to not have the pragma packs, but this means I can't reuse
        my code with different SDL.dll (or someone else).

        Thanks,
        Dimiter 'malkia' Stanev.
        _________________________________________________
        SDL mailing list
        SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
        http://lists.libsdl.org/__listinfo.cgi/sdl-libsdl.org
        <http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org>



    _______________________________________________
    SDL mailing list
    SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
    http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org



_______________________________________________
SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org