From 420ba48099c9debe85e76b28b7ef7b2e05d5bed5 Mon Sep 17 00:00:00 2001
From: John Lenz
- In all cases, the constants may be accessed from with CHICKEN
+ In all cases, the constants may be accessed from within CHICKEN
using the form (MYCONSTANT1); that is, the constants
may be accessed using the read-only parameter form.
Chicken supports both the An alternative is the test_script.scm can have the code An alternative is that the test_script.scm can have the code Building a shared library like in the above section only works if the library
is linked at compile time with a script containing This library can then be loaded by scheme code with the SWIG_exception(int code, const char *msg) interface
as well as a SWIG_ThrowException(C_word val) function for throwing exceptions from
- inside the %exception blocks. SWIG_exception will throw a list consiting of the code
+ inside the %exception blocks. SWIG_exception will throw a list consisting of the code
(as an integer) and the message. Both of these will throw an exception using (abort),
which can be handled by (handle-exceptions). See
Chicken manual on Exceptions
@@ -378,7 +378,7 @@ $ csc -v test_script.scm -lexample
-(load-library 'example "example.so"),
+(load-library 'example "example.so"),
in which case the test script does not need to be linked with example.so. The test_script.scm file can then
be run with csi.
(declare (uses ...)) or is
-loaded explictetly with (load-library 'example "example.so"). It is
-not the format that chicken expects for extension libraries and eggs. The problem is the
+loaded explicitly with (load-library 'example "example.so"). It is
+not the format that CHICKEN expects for extension libraries and eggs. The problem is the
(declare (unit modname)) inside the modname.scm file. There are
two possible solutions to this.(require 'modname) function.
See
-Loading-extension-libraries in the eval unit inside the Chicken manual for more information.
Another alternative is to run SWIG normally and create a scheme file that contains (declare (uses modname))
and then compile that file into the shared library as well. For example, inside the mod_load.scm file,
Linking together multiple modules that share type information using the %import
directive while also using -proxy is more complicated. For example, if mod2.i imports mod1.i, then the
mod2.scm file contains references to symbols declared in mod1.scm,
diff --git a/SWIG/Examples/chicken/README b/SWIG/Examples/chicken/README
index fb518ce02..6245f41e3 100644
--- a/SWIG/Examples/chicken/README
+++ b/SWIG/Examples/chicken/README
@@ -10,5 +10,3 @@ zlib -- a wrapping of the zlib compression library
You should be able to run make in each of the examples. By default, a shared
library will be built. Run make check to execute the test.
-
-You can uncomment a few lines in the Makefile to build a static test exe.
diff --git a/SWIG/Examples/chicken/class/Makefile b/SWIG/Examples/chicken/class/Makefile
index cf79b7ffa..1261ec5ac 100644
--- a/SWIG/Examples/chicken/class/Makefile
+++ b/SWIG/Examples/chicken/class/Makefile
@@ -7,7 +7,7 @@ TARGET = class
INCLUDE =
SWIGOPT =
CFLAGS =
-VARIANT = _csc
+VARIANT =
# uncomment the following lines to build a static exe (only pick one of the CHICKEN_MAIN lines)
#CHICKEN_MAIN = test-lowlevel-class.scm
diff --git a/SWIG/Examples/chicken/class/test-lowlevel-class.scm b/SWIG/Examples/chicken/class/test-lowlevel-class.scm
index 820b3fc06..7c59c0aaa 100644
--- a/SWIG/Examples/chicken/class/test-lowlevel-class.scm
+++ b/SWIG/Examples/chicken/class/test-lowlevel-class.scm
@@ -64,8 +64,9 @@
(display "\nGuess I'll clean up now\n")
;; Note: this invokes the virtual destructor
-(delete-Shape c)
-(delete-Shape s)
+(set! c #f)
+(set! s #f)
+(gc #t)
(set! s 3)
(display (Shape-nshapes))
diff --git a/SWIG/Examples/chicken/class/test-tinyclos-class.scm b/SWIG/Examples/chicken/class/test-tinyclos-class.scm
index 45e241edb..809a39e6d 100644
--- a/SWIG/Examples/chicken/class/test-tinyclos-class.scm
+++ b/SWIG/Examples/chicken/class/test-tinyclos-class.scm
@@ -20,7 +20,7 @@
;; ----- Access a static member -----
(display "\nA total of ")
-(display (nshapes))
+(display (Shape-nshapes))
(display " shapes were created\n")
;; ----- Member data access -----
@@ -67,9 +67,9 @@
;; Note: Invoke the virtual destructors by forcing garbage collection
(set! c 77)
(set! s 88)
-;(gc #t)
+(gc #t)
-(display (nshapes))
+(display (Shape-nshapes))
(display " shapes remain\n")
(display "Goodbye\n")
diff --git a/SWIG/Examples/chicken/constants/test-constants.scm b/SWIG/Examples/chicken/constants/test-constants.scm
index a5dcbd34f..1b10b2605 100644
--- a/SWIG/Examples/chicken/constants/test-constants.scm
+++ b/SWIG/Examples/chicken/constants/test-constants.scm
@@ -1,8 +1,6 @@
-;; run with './constants test-constants.scm'
;; feel free to uncomment and comment sections
-(load-library 'example "constants.so")
-(declare (uses example))
+(load-library 'example "./constants.so")
(display "starting test ... you will see 'finished' if successful.\n")
(or (= (ICONST) 42) (exit 1))
diff --git a/SWIG/Examples/chicken/multimap/test-multimap.scm b/SWIG/Examples/chicken/multimap/test-multimap.scm
index 8080edd4a..0f5653fc5 100644
--- a/SWIG/Examples/chicken/multimap/test-multimap.scm
+++ b/SWIG/Examples/chicken/multimap/test-multimap.scm
@@ -2,7 +2,6 @@
;; feel free to uncomment and comment sections
(load-library 'example "multimap.so")
-(declare (uses example))
(display "(gcd 90 12): ")
(display (gcd 90 12))
diff --git a/SWIG/Examples/chicken/overload/test-overload.scm b/SWIG/Examples/chicken/overload/test-overload.scm
index 16a7fc75e..168490f76 100644
--- a/SWIG/Examples/chicken/overload/test-overload.scm
+++ b/SWIG/Examples/chicken/overload/test-overload.scm
@@ -1,8 +1,6 @@
;; This file demonstrates the overloading capabilities of SWIG
(load-library 'example "overload.so")
-(declare (uses example))
-(declare (uses tinyclos))
;; Low level
;; ---------
@@ -40,7 +38,7 @@ Trying TinyCLOS code ...
(foo 1)
(foo "some string")
(define A-FOO (make