[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    Trouble with lua_newstate() syntax
From:       Dave Bollinger <DBollinger () compuserve ! com>
Date:       2000-06-18 18:35:43
Message-ID: 200006181436_MC2-A92C-3845 () compuserve ! com
[Download RAW message or body]

  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.  :-)


  Cheers,

  Dave

  (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
function.)

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic