ILAPIENTRY on MingW

2006-08-10
2013-05-02
  • MingW supports __stdcall attribute. Currently, since ILAPIENTRY is an empty define for all GCC compilers, calling ilSetMemory with custom allocator/deallocator causes a SEGFAULT unless the functions are declared __stdcall explicity. Of course, this breaks compatibility with other GCC compilers. il.h should be changed thusly:

    //===============================================
    #elif defined( __GNUC__ )
      // this should work for any of the above commented platforms
      // plus any platform using GCC
            #ifdef __MINGW32__
                #define ILAPIENTRY __stdcall
            #else
            #define ILAPIENTRY
        #define IL_PACKSTRUCT __attribute__ ((packed))
    #else
    //================================================

     
    • In the previous post, I forgot the matching #endif:

      //===============================================
      #elif defined( __GNUC__ )
      // this should work for any of the above commented platforms 
      // plus any platform using GCC
      #ifdef __MINGW32__
      #define ILAPIENTRY __stdcall
      #else
      #define ILAPIENTRY
      #endif
      #define IL_PACKSTRUCT __attribute__ ((packed))
      #else
      //============================================

       
      • Thanks. I committed this to CVS.