Updates to the 'simple' example for the Pike module.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4752 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
556b711f62
commit
f28f502667
3 changed files with 8 additions and 8 deletions
|
|
@ -4,15 +4,15 @@ SRCS = example.c
|
|||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
|
||||
all::
|
||||
all:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike
|
||||
|
||||
static::
|
||||
static:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||
TARGET='mypike' INTERFACE='$(INTERFACE)' pike_static
|
||||
|
||||
clean::
|
||||
clean:
|
||||
$(MAKE) -f $(TOP)/Makefile pike_clean
|
||||
|
||||
check: all
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
%module example
|
||||
|
||||
extern int gcd(int x, int y);
|
||||
/* extern double Foo; */
|
||||
extern double Foo;
|
||||
|
|
|
|||
|
|
@ -4,17 +4,17 @@ int main()
|
|||
int x = 42;
|
||||
int y = 105;
|
||||
int g = .example.gcd(x, y);
|
||||
write(sprintf("The gcd of %d and %d is %d\n", x, y, g));
|
||||
write("The gcd of %d and %d is %d\n", x, y, g);
|
||||
|
||||
/* Manipulate the Foo global variable */
|
||||
/* Output its current value */
|
||||
/* write(sprintf("Foo = %f\n", .example.Foo_get())); */
|
||||
write("Foo = %f\n", .example->Foo_get());
|
||||
|
||||
/* Change its value */
|
||||
/* .example.Foo_set(3.1415926); */
|
||||
.example->Foo_set(3.1415926);
|
||||
|
||||
/* See if the change took effect */
|
||||
/* write(sprintf("Foo = %f\n", .example.Foo_get())); */
|
||||
write("Foo = %f\n", .example->Foo_get());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue