update swig on windows
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
SRCS = example.cxx
|
||||
|
||||
include $(SRCDIR)../example.mk
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"targets": [
|
||||
{
|
||||
"target_name": "example",
|
||||
"sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ],
|
||||
"include_dirs": ["$srcdir"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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;
|
||||
%}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = require("build/Release/example");
|
||||
26
winx64/bin/swigwin-4.0.0/Examples/javascript/simple/runme.js
Normal file
26
winx64/bin/swigwin-4.0.0/Examples/javascript/simple/runme.js
Normal file
@@ -0,0 +1,26 @@
|
||||
var example = require("example");
|
||||
|
||||
/* Call our gcd() function */
|
||||
|
||||
x = 42;
|
||||
y = 105;
|
||||
g = example.gcd(x,y);
|
||||
console.log("GCD of x and y is=" + g);
|
||||
|
||||
/* Manipulate the Foo global variable */
|
||||
|
||||
/* Output its current value */
|
||||
console.log("Global variable Foo=" + example.Foo);
|
||||
|
||||
/* Change its value */
|
||||
example.Foo = 3.1415926;
|
||||
|
||||
/* See if the change took effect */
|
||||
console.log("Variable Foo changed to=" + example.Foo);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user