Visual C++ 8 warning fixes

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10229 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-02-02 00:52:14 +00:00
commit df83cef573
6 changed files with 15 additions and 6 deletions

View file

@ -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

View file

@ -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 <stdio.h>
#include <stdlib.h>
#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);

View file

@ -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);
}
%}

View file

@ -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
%}

View file

@ -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);
%}