Shouldn't this line be:
    
    LUALIB_API int luaopen_yajl(lua_State * L)
    
(I was trying to port Mudlet to Cygwin last week and this was a sticking point.)