I'm creating a header file (to be included in DLL projects) that allows DLLs to communicate with the larger, main application. The header file declares a struct, and I've figured that the structure must be packed to ensure that different compilers don't insert padding in different places, leading to a situation in which the application and the DLLs (built with different compilers) have separate views of the same struct definition.
However, different compilers have varying ways of indicating that a structure should be packed (VC++'s pragma directive as opposed to MingW's __attribute__); is there a way to detect which compiler is being used so the correct directive may be invoked?