update swig on windows
This commit is contained in:
17
winx64/bin/swigwin-4.0.0/Examples/scilab/simple/Makefile
Normal file
17
winx64/bin/swigwin-4.0.0/Examples/scilab/simple/Makefile
Normal file
@@ -0,0 +1,17 @@
|
||||
TOP = ../..
|
||||
SWIGEXE = $(TOP)/../swig
|
||||
SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
|
||||
SRCS = example.c
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
|
||||
check: build
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_run
|
||||
|
||||
build:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_clean
|
||||
18
winx64/bin/swigwin-4.0.0/Examples/scilab/simple/example.c
Normal file
18
winx64/bin/swigwin-4.0.0/Examples/scilab/simple/example.c
Normal file
@@ -0,0 +1,18 @@
|
||||
/* File : example.c */
|
||||
|
||||
/* A global variable */
|
||||
double Foo = 3.0;
|
||||
|
||||
/* Compute the greatest common divisor of positive integers */
|
||||
int gcd(int x, int y) {
|
||||
int g;
|
||||
g = y;
|
||||
while (x > 0) {
|
||||
g = x;
|
||||
x = y % x;
|
||||
y = g;
|
||||
}
|
||||
return g;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/* File : example.i */
|
||||
%module example
|
||||
|
||||
%inline %{
|
||||
extern int gcd(int x, int y);
|
||||
extern double Foo;
|
||||
%}
|
||||
29
winx64/bin/swigwin-4.0.0/Examples/scilab/simple/runme.sci
Normal file
29
winx64/bin/swigwin-4.0.0/Examples/scilab/simple/runme.sci
Normal file
@@ -0,0 +1,29 @@
|
||||
lines(0);
|
||||
ilib_verbose(0);
|
||||
ierr = exec('loader.sce', 'errcatch');
|
||||
if ierr <> 0 then
|
||||
disp(lasterror());
|
||||
exit(ierr);
|
||||
end
|
||||
|
||||
// Call our gcd() function
|
||||
|
||||
x = 42;
|
||||
y = 105;
|
||||
g = gcd(x,y);
|
||||
printf("The gcd of %d and %d is %d\n",x,y,g);
|
||||
|
||||
// Manipulate the Foo global variable
|
||||
|
||||
// Get its default value (see in example.c)
|
||||
defaultValue = Foo_get()
|
||||
if defaultValue <> 3 then pause; end
|
||||
|
||||
// Change its value
|
||||
Foo_set(3.1415926)
|
||||
|
||||
// See if the change took effect
|
||||
if Foo_get() <> 3.1415926 then pause,end
|
||||
|
||||
exit
|
||||
|
||||
Reference in New Issue
Block a user