update swig on windows
This commit is contained in:
20
winx64/bin/swigwin-4.0.0/Examples/php/simple/Makefile
Normal file
20
winx64/bin/swigwin-4.0.0/Examples/php/simple/Makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
TOP = ../..
|
||||
SWIGEXE = $(TOP)/../swig
|
||||
SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
|
||||
SRCS = example.c
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
LIBS =
|
||||
SWIGOPT =
|
||||
|
||||
check: build
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
|
||||
|
||||
build:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
|
||||
php
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean
|
||||
23
winx64/bin/swigwin-4.0.0/Examples/php/simple/example.c
Normal file
23
winx64/bin/swigwin-4.0.0/Examples/php/simple/example.c
Normal file
@@ -0,0 +1,23 @@
|
||||
/* File : example.c */
|
||||
#include <stdio.h>
|
||||
|
||||
/* A global variable */
|
||||
double Foo = 3.0;
|
||||
|
||||
void print_Foo() {
|
||||
printf("In C, Foo = %f\n",Foo);
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
||||
8
winx64/bin/swigwin-4.0.0/Examples/php/simple/example.i
Normal file
8
winx64/bin/swigwin-4.0.0/Examples/php/simple/example.i
Normal file
@@ -0,0 +1,8 @@
|
||||
/* File : example.i */
|
||||
%module example
|
||||
|
||||
%inline %{
|
||||
extern int gcd(int x, int y);
|
||||
extern double Foo;
|
||||
void print_Foo();
|
||||
%}
|
||||
25
winx64/bin/swigwin-4.0.0/Examples/php/simple/runme.php
Normal file
25
winx64/bin/swigwin-4.0.0/Examples/php/simple/runme.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require "example.php";
|
||||
|
||||
# Call our gcd() function
|
||||
|
||||
$x = "42 aaa";
|
||||
$y = 105;
|
||||
$g = gcd($x,$y);
|
||||
print "The gcd of $x and $y is $g\n";
|
||||
|
||||
# Manipulate the Foo global variable
|
||||
|
||||
# Output its current value
|
||||
print "Foo = " . Foo_get() . "\n";
|
||||
|
||||
# Change its value
|
||||
Foo_set(3.1415926);
|
||||
|
||||
# See if the change took effect ( this isn't a good example for php, see
|
||||
# manual for why. )
|
||||
print "Foo = " . Foo_get() . "\n";
|
||||
print_Foo();
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user