Merged with recent changes from trunk.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-maciekd@11187 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
da5ade3143
commit
8c74fa0f46
703 changed files with 21126 additions and 9266 deletions
24
Examples/php/sync/Makefile
Normal file
24
Examples/php/sync/Makefile
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
TOP = ../..
|
||||
SWIG = $(TOP)/../preinst-swig
|
||||
CXXSRCS = example.cxx
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
LIBS =
|
||||
SWIGOPT =
|
||||
|
||||
all::
|
||||
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
|
||||
php_cpp
|
||||
|
||||
static::
|
||||
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \
|
||||
php_cpp_static
|
||||
|
||||
clean::
|
||||
$(MAKE) -f $(TOP)/Makefile php_clean
|
||||
rm -f $(TARGET).php
|
||||
|
||||
check: all
|
||||
$(MAKE) -f $(TOP)/Makefile php_run
|
||||
13
Examples/php/sync/example.cxx
Normal file
13
Examples/php/sync/example.cxx
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include "example.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int x = 42;
|
||||
char *s = (char *)"Test";
|
||||
|
||||
void Sync::printer(void) {
|
||||
|
||||
printf("The value of global s is %s\n", s);
|
||||
printf("The value of global x is %d\n", x);
|
||||
printf("The value of class s is %s\n", s);
|
||||
printf("The value of class x is %d\n", x);
|
||||
};
|
||||
9
Examples/php/sync/example.h
Normal file
9
Examples/php/sync/example.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
extern char *s;
|
||||
extern int x;
|
||||
|
||||
class Sync {
|
||||
public:
|
||||
int x;
|
||||
char *s;
|
||||
void printer(void);
|
||||
};
|
||||
7
Examples/php/sync/example.i
Normal file
7
Examples/php/sync/example.i
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
%module example
|
||||
|
||||
%{
|
||||
#include "example.h"
|
||||
%}
|
||||
|
||||
%include "example.h"
|
||||
15
Examples/php/sync/runme.php
Normal file
15
Examples/php/sync/runme.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?
|
||||
|
||||
// Load module and PHP classes.
|
||||
include("example.php");
|
||||
|
||||
echo "Got new object\n";
|
||||
echo "Got string $s and value $x \n";
|
||||
|
||||
$s = new Sync();
|
||||
echo "Got new object\n";
|
||||
|
||||
$s->printer();
|
||||
|
||||
?>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue