lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

  The use of varargs in lua_newstate() is troublesome on the Windows
platform when building a DLL.  If you want to build a "correct" DLL you
cannot use the C calling convention, thus can't use varargs, thus you can't
export that function.  That makes using Lua a bit difficult!  ;->

  Easy solution is to just wrap the call inside something that doesn't
require varargs, either by ignoring the optional configuration and passing
no args, or by passing a structure containing the necessary fields and
passing a single pointer.  But I wonder if something like this might be
worth including in the real version?  Just to give an idea:

  struct lua_config
    int builtin;
    int stack;
  typedef struct lua_config lua_Config;
  lua_State *lua_newstate(lua_Config *config);

    Of course, allow NULL to be passed to take all defaults.  If necessary,
add a bitmapped flag field to indicate which settings are actually
specified.  Food for thought.  :-)



  (P.S.  luaL_verror() obviously has the same problem, but I see no easy
way around that one, and is easier to lose since it's just an aux