Re: [AD] Re: binary compatibility check

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Tuesday 07 February 2006 13:49, Elias Pschernig wrote:
> It seems, a function declared
> with AL_INLINE can't have #ifs inside it with my mingw version. I'm not
> really sure what's going on, anyone has an idea how to fix it?

Well, as it says:
include/allegro/system.h:87:1: directives may not be used inside a macro

There's a few ways to fix this. One is to move the directives outside of the 
body, and duplicate the inline method (this would introduce a bit of code 
duplication, though. A second option would be to change AL_INLINE, so the 
body is not part of the argument list. eg. instead of:
AL_INLINE(void, func, (args),
{
  body
})

to do instead:

AL_INLINE(void, func, (args))
{
  body
}

Since the body won't be in the macro, you can use directives. A third 
(modified second) method that doesn't involve changing AL_INLINE would be to 
just leave the body argument empty, and put the body after the macro:

AL_INLINE(void, func, (args),)
{
  body
}

I did this, and it works fine in Linux/GCC 3.4.4.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/