diff --git a/Examples/lua/dual/Makefile b/Examples/lua/dual/Makefile index ceae37936..b4e28f331 100644 --- a/Examples/lua/dual/Makefile +++ b/Examples/lua/dual/Makefile @@ -5,8 +5,8 @@ CXXSRCS = example2_wrap.cxx INTERFACE = dual.i LUA_INTERP = dual.cpp -# this is a little different ot normal as we need to static link two modules and a custom intepreter -# we need the external runtime, then swig examples2, and build the module as normal +# This is a little different to normal as we need to static link two modules and a custom interpreter +# We need the external runtime, then swig examples2, and build the module as normal all:: $(SWIG) -lua -external-runtime $(SWIG) -c++ -lua $(SWIGOPT) example2.i @@ -15,6 +15,7 @@ all:: clean:: $(MAKE) -f $(TOP)/Makefile lua_clean + rm -f swigluarun.h check: all diff --git a/Examples/lua/dual/dual.cpp b/Examples/lua/dual/dual.cpp index 055ea03af..d2a9ecaa9 100644 --- a/Examples/lua/dual/dual.cpp +++ b/Examples/lua/dual/dual.cpp @@ -23,11 +23,11 @@ the two modules are now linked together, and all can now find both Foo and Bar. */ +#include "swigluarun.h" // the swig runtimes + #include #include -#include "swigluarun.h" // the swig runtimes - // the 2 libraries which are wrappered via SWIG extern "C" int luaopen_example(lua_State*L); extern "C" int luaopen_example2(lua_State*L); diff --git a/Examples/lua/funcptr3/example.i b/Examples/lua/funcptr3/example.i index 501af1d89..319b2274c 100644 --- a/Examples/lua/funcptr3/example.i +++ b/Examples/lua/funcptr3/example.i @@ -28,7 +28,7 @@ int callback(int a, int b, SWIGLUA_FN fn) lua_pushnumber(fn.L,a); lua_pushnumber(fn.L,b); lua_call(fn.L,2,1); /* 2 in, 1 out */ - return luaL_checknumber(fn.L,-1); + return (int)luaL_checknumber(fn.L,-1); } %} diff --git a/Examples/lua/functest/example.i b/Examples/lua/functest/example.i index 24729d4b5..631e0602d 100644 --- a/Examples/lua/functest/example.i +++ b/Examples/lua/functest/example.i @@ -4,8 +4,10 @@ %include "typemaps.i" // you must have this for the typemaps for ptrs // basic function testing // +%inline %{ extern int add1(int x, int y); // return x+y -- basic function test extern void add2(int x, int *INPUT, int *OUTPUT); // *z = x+*y -- argin and argout test extern int add3(int x, int y, int *OUTPUT); // return x+y, *z=x-y -- returning 2 values extern void add4(int x, int *INOUT); // *y += x -- INOUT dual purpose variable +%} diff --git a/Examples/lua/pointer/example.i b/Examples/lua/pointer/example.i index c6b4f2c19..d49365ba1 100644 --- a/Examples/lua/pointer/example.i +++ b/Examples/lua/pointer/example.i @@ -9,7 +9,9 @@ for manipulating C pointers */ /* First we'll use the pointer library */ +%inline %{ extern void add(int *x, int *y, int *result); +%} %include cpointer.i %pointer_functions(int, intp); @@ -17,11 +19,16 @@ extern void add(int *x, int *y, int *result); %include typemaps.i extern void sub(int *INPUT, int *INPUT, int *OUTPUT); +%{ +extern void sub(int *, int *, int *); +%} /* Next we'll use typemaps and the %apply directive */ %apply int *OUTPUT { int *r }; +%inline %{ extern int divide(int n, int d, int *r); +%} diff --git a/Lib/lua/luarun.swg b/Lib/lua/luarun.swg index f9a45192f..f27f2928a 100644 --- a/Lib/lua/luarun.swg +++ b/Lib/lua/luarun.swg @@ -515,7 +515,6 @@ SWIGINTERN void SWIG_Lua_init_base_class(lua_State* L,swig_lua_class* clss) /* performs the entire class registration process */ SWIGINTERN void SWIG_Lua_class_register(lua_State* L,swig_lua_class* clss) { - int i; /* add its constructor to module with the name of the class so you can do MyClass(...) as well as new_MyClass(...) BUT only if a constructor is defined