aboutsummaryrefslogtreecommitdiff
path: root/Examples
diff options
context:
space:
mode:
authorMatthias Köppe <mkoeppe@mail.math.uni-magdeburg.de>2000-09-03 20:06:32 +0000
committerMatthias Köppe <mkoeppe@mail.math.uni-magdeburg.de>2000-09-03 20:06:32 +0000
commit27705dc6ff015f68cf6412d39a9c1e9cc6daf1d8 (patch)
tree77a67fa9855b5a00e573eabd805119576bf48094 /Examples
parentebf5116c60e46db02ce6757eda163ca7f51452c9 (diff)
downloadswig-27705dc6ff015f68cf6412d39a9c1e9cc6daf1d8.tar.gz
Updated Guile modules.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@815 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Examples')
-rw-r--r--Examples/GIFPlot/Guile/full/Makefile11
-rw-r--r--Examples/GIFPlot/Guile/full/runme.scm3
-rw-r--r--Examples/GIFPlot/Guile/simple/Makefile11
-rw-r--r--Examples/GIFPlot/Guile/simple/README10
-rw-r--r--Examples/GIFPlot/Guile/simple/runme.scm6
-rw-r--r--Examples/Makefile.in40
-rw-r--r--Examples/guile/README7
7 files changed, 55 insertions, 33 deletions
diff --git a/Examples/GIFPlot/Guile/full/Makefile b/Examples/GIFPlot/Guile/full/Makefile
index 74915ad16..608e394da 100644
--- a/Examples/GIFPlot/Guile/full/Makefile
+++ b/Examples/GIFPlot/Guile/full/Makefile
@@ -9,10 +9,17 @@ INCLUDE = -I../../Include
all:: static
+dynamic::
+ $(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \
+ SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ INCLUDE='$(INCLUDE)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile
+
static::
- $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \
+ SRCS='$(SRCS)' SWIG='$(SWIG)' \
INCLUDE='$(INCLUDE)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \
- TARGET='gifguile' INTERFACE='$(INTERFACE)' guile_static
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_static
clean::
rm -f *_wrap* *.o *~ *.so gifguile .~* core *.gif
diff --git a/Examples/GIFPlot/Guile/full/runme.scm b/Examples/GIFPlot/Guile/full/runme.scm
index 9cf264aa9..0ffe92167 100644
--- a/Examples/GIFPlot/Guile/full/runme.scm
+++ b/Examples/GIFPlot/Guile/full/runme.scm
@@ -1,5 +1,8 @@
;;; Plot a 3D function
+;; Use the wrapped GIFPlot library
+(use-modules (gifplot))
+
;; Here is the function to plot
(define (func x y)
(* 5
diff --git a/Examples/GIFPlot/Guile/simple/Makefile b/Examples/GIFPlot/Guile/simple/Makefile
index 77fe283d3..f3397cf22 100644
--- a/Examples/GIFPlot/Guile/simple/Makefile
+++ b/Examples/GIFPlot/Guile/simple/Makefile
@@ -9,10 +9,17 @@ INCLUDE = -I../../Include
all:: static
+dynamic::
+ $(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \
+ SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ INCLUDE='$(INCLUDE)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile
+
static::
- $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \
+ SRCS='$(SRCS)' SWIG='$(SWIG)' \
INCLUDE='$(INCLUDE)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \
- TARGET='gifguile' INTERFACE='$(INTERFACE)' guile_static
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_static
clean::
rm -f *_wrap* *.o *~ *.so gifguile .~* core *.gif
diff --git a/Examples/GIFPlot/Guile/simple/README b/Examples/GIFPlot/Guile/simple/README
index 575e993cf..1925efa93 100644
--- a/Examples/GIFPlot/Guile/simple/README
+++ b/Examples/GIFPlot/Guile/simple/README
@@ -1,3 +1,11 @@
This is a very minimalistic example in which just a few functions
and constants from library are wrapped and used to draw some simple
-shapes. Run `gifguile -s runme.scm'.
+shapes.
+
+`make' will build a version of Guile which defines an additional
+module (simple). Run `./simple-guile -s runme.scm' to test it.
+
+`make dynamic' will build a dynamically loadable module, which can be
+loaded from any Guile interpreter. Run `guile -s runme.scm' to test
+it. The `use-modules' call in `runme.scm' dynamically loads the
+module.
diff --git a/Examples/GIFPlot/Guile/simple/runme.scm b/Examples/GIFPlot/Guile/simple/runme.scm
index 615974533..40ec18101 100644
--- a/Examples/GIFPlot/Guile/simple/runme.scm
+++ b/Examples/GIFPlot/Guile/simple/runme.scm
@@ -1,4 +1,8 @@
-;; Draw some simple shapes
+;;; Draw some simple shapes
+
+;; Use the wrapped GIFPlot library
+(use-modules (simple))
+
(display "Drawing some basic shapes\n")
(define cmap (new-ColorMap))
diff --git a/Examples/Makefile.in b/Examples/Makefile.in
index 4447836f3..797472063 100644
--- a/Examples/Makefile.in
+++ b/Examples/Makefile.in
@@ -244,39 +244,23 @@ python_static_cpp: $(SRCS)
GUILE_INCLUDE = @GUILEINCLUDE@
GUILE_LIB = @GUILELIB@
-
-# ----------------------------------------------------------------
-# Build a C dynamically loadable module
-# ----------------------------------------------------------------
-
-guile-hobbit: $(SRCS)
- $(SWIG) -guile -Linkage hobbit $(SWIGOPT) $(INTERFACE)
- for f in $^ ; do $(libtool_comp) $(CC) -c -O2 $(INCLUDE) $$f ; done
- $(libtool_link) $(CC) -g -O2 -o lib$^.la -rpath `pwd` $^
-
# ----------------------------------------------------------------
# Build a C dynamically loadable module
# ----------------------------------------------------------------
guile: $(SRCS)
- $(SWIG) -guile $(SWIGOPT) $(INTERFACE)
- for f in $(ISRCS) ; do $(libtool_comp) \
- $(CC) -c $(INCLUDE) $(GUILE_INCLUDE) $(ISRCS) ; done
- $(libtool_link) $(LDSHARED) -o lib$(TARGET)$(SO) \
- $(OBJS) $(IOBJS) $(LIBS)
+ $(SWIG) -guile -Linkage ltdlmod $(SWIGOPT) $(INTERFACE)
+ $(CC) -c $(CCSHARED) $(CFLAGS) $(INCLUDE) $(GUILE_INCLUDE) $(ISRCS) $(SRCS)
+ $(LDSHARED) $(OBJS) $(IOBJS) $(LIBS) -o lib$(TARGET)$(SO)
# -----------------------------------------------------------------
# Build a C++ dynamically loadable module
# -----------------------------------------------------------------
guile_cpp: $(SRCS)
- $(SWIG) -c++ -guile $(SWIGOPT) $(INTERFACE)
- $(libtool) compile \
- $(CXX) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(SRCS) $(CXXSRCS) \
- $(INCLUDE) $(GUILE_INCLUDE)
- $(libtool) link \
- $(CXXSHARED) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) \
- -o lib$(TARGET)$(SO)
+ $(SWIG) -c++ -guile -Linkage ltdlmod $(SWIGOPT) $(INTERFACE)
+ $(CXX) -c $(CCSHARED) $(CFLAGS) $(INCLUDE) $(GUILE_INCLUDE) $(ISRCS) $(SRCS) $(CXXSRCS)
+ $(LDSHARED) $(OBJS) $(IOBJS) $(LIBS) -o lib$(TARGET)$(SO)
# -----------------------------------------------------------------
# Build statically linked Guile interpreter
@@ -285,14 +269,16 @@ guile_cpp: $(SRCS)
GUILE_LIBOPTS = @GUILELINK@ @LIBS@ $(SYSLIBS)
guile_static: $(SRCS)
- $(SWIG) -guile -lguilemain.i $(SWIGOPT) $(INTERFACE)
- $(CC) $(CFLAGS) @LINKFORSHARED@ $(ISRCS) $(SRCS) $(INCLUDE) \
- $(GUILE_INCLUDE) $(LIBS) -L$(GUILE_LIB) $(GUILE_LIBOPTS) -o $(TARGET)
+ $(SWIG) -guile -lguilemain.i -Linkage ltdlmod $(SWIGOPT) $(INTERFACE)
+ $(CC) $(CFLAGS) $(ISRCS) $(SRCS) $(INCLUDE) \
+ -DSWIGINIT="scm_init_$(TARGET)_module();" \
+ $(GUILE_INCLUDE) $(LIBS) -L$(GUILE_LIB) $(GUILE_LIBOPTS) -o $(TARGET)-guile
guile_static_cpp: $(SRCS)
- $(SWIG) -c++ -guile -lguilemain.i $(SWIGOPT) $(INTERFACE)
+ $(SWIG) -c++ -guile -lguilemain.i -Linkage ltdlmod $(SWIGOPT) $(INTERFACE)
$(CXX) $(CFLAGS) $(ISRCS) $(SRCS) $(CXXSRCS) $(INCLUDE) \
- $(GUILE_INCLUDE) $(LIBS) -L$(GUILE_LIB) $(GUILE_LIBOPTS) -o $(TARGET)
+ -DSWIGINIT="scm_init_$(TARGET)_module();" \
+ $(GUILE_INCLUDE) $(LIBS) -L$(GUILE_LIB) $(GUILE_LIBOPTS) -o $(TARGET)-guile
##################################################################
diff --git a/Examples/guile/README b/Examples/guile/README
index 211045a4f..e006d02ce 100644
--- a/Examples/guile/README
+++ b/Examples/guile/README
@@ -2,3 +2,10 @@ This directory contains examples for Guile.
simple - The simple example from the user manual.
matrix - A very simple Matrix example.
+
+Note that the examples in this directory build a special version of
+Guile which includes the wrapped functions in the top-level module.
+
+If you want to put the wrapped functions into an own module,
+statically or dynamically linked, see the Examples/GIFPlot/Guile
+directory.