The great merge
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6fcc22a1f8
commit
516036631c
1508 changed files with 125983 additions and 44037 deletions
9
SWIG/Examples/ruby/pointer/.cvsignore
Normal file
9
SWIG/Examples/ruby/pointer/.cvsignore
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
*_wrap.c
|
||||
*_wrap.cxx
|
||||
example.dll
|
||||
example.dsw
|
||||
example.ncb
|
||||
example.opt
|
||||
example.plg
|
||||
Release
|
||||
Debug
|
||||
|
|
@ -13,6 +13,6 @@ static::
|
|||
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static
|
||||
|
||||
clean::
|
||||
rm -f *_wrap* *.o *~ *.so myruby .~* core
|
||||
$(MAKE) -f $(TOP)/Makefile ruby_clean
|
||||
|
||||
check: all
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@
|
|||
|
||||
/* First we'll use the pointer library */
|
||||
extern void add(int *x, int *y, int *result);
|
||||
%include pointer.i
|
||||
%include cpointer.i
|
||||
%pointer_functions(int, intp);
|
||||
|
||||
/* Next we'll use some typemaps */
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,12 @@ require 'example'
|
|||
|
||||
# First create some objects using the pointer library.
|
||||
print "Testing the pointer library\n"
|
||||
a = Example::ptrcreate("int", 37)
|
||||
b = Example::ptrcreate("int", 42)
|
||||
c = Example::ptrcreate("int");
|
||||
a = Example::new_intp()
|
||||
b = Example::new_intp()
|
||||
c = Example::new_intp()
|
||||
|
||||
Example::intp_assign(a,37)
|
||||
Example::intp_assign(b,42)
|
||||
|
||||
print " a = #{a}\n"
|
||||
print " b = #{b}\n"
|
||||
|
|
@ -16,13 +19,13 @@ print " c = #{c}\n"
|
|||
Example::add(a, b, c)
|
||||
|
||||
# Now get the result
|
||||
r = Example::ptrvalue(c)
|
||||
r = Example::intp_value(c)
|
||||
print " 37 + 42 = #{r}\n"
|
||||
|
||||
# Clean up the pointers
|
||||
Example::ptrfree(a)
|
||||
Example::ptrfree(b)
|
||||
Example::ptrfree(c)
|
||||
Example::delete_intp(a)
|
||||
Example::delete_intp(b)
|
||||
Example::delete_intp(c)
|
||||
|
||||
# Now try the typemap library
|
||||
# This should be much easier. Now how it is no longer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue