aboutsummaryrefslogtreecommitdiff
path: root/Doc/Manual
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2013-05-08 12:42:17 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2013-05-08 12:42:17 +0100
commit70b9df5ee9513f263758b1b491c00f20e6e7adaf (patch)
treeeba81379183dda90e36d0002dbffdbd533fcd0c7 /Doc/Manual
parent4ed422da6050b5004a14f31ab5caa9e012b99a78 (diff)
downloadswig-70b9df5ee9513f263758b1b491c00f20e6e7adaf.tar.gz
Portable dynamic library loading for Guile
dynamic-link and load-extension work without passing the .so or .dll as the shared library extension, so these have been dropped so the examples and test-suite work on Cygwin. Also update documentation and use the 'lib' prefix as that is what we commonly name the shared libraries.
Diffstat (limited to 'Doc/Manual')
-rw-r--r--Doc/Manual/Guile.html34
1 files changed, 22 insertions, 12 deletions
diff --git a/Doc/Manual/Guile.html b/Doc/Manual/Guile.html
index 8ecdf249c..cfbfbd0b7 100644
--- a/Doc/Manual/Guile.html
+++ b/Doc/Manual/Guile.html
@@ -115,7 +115,7 @@ libraries into Guile.</p>
<div class="targetlang">
<pre>
(define-module (my module))
-(define my-so (dynamic-link "./example.so"))
+(define my-so (dynamic-link "./libexample.so"))
(dynamic-call "SWIG_init" my-so) ; make SWIG bindings
;; Scheme definitions can go here
</pre>
@@ -128,7 +128,17 @@ and <code>dynamic-call</code>:
<div class="targetlang">
<pre>
-(load-extension "./example.so" "SWIG_init")
+(load-extension "./libexample.so" "SWIG_init")
+</pre>
+</div>
+
+<p>
+A more portable approach would be to drop the shared library extension:
+</p>
+
+<div class="targetlang">
+<pre>
+(load-extension "./libexample" "SWIG_init")
</pre>
</div>
@@ -171,7 +181,7 @@ information by including a directive like this in the interface file:
<div class="code">
<pre>
-%scheme %{ (load-extension "./example.so" "SWIG_init") %}
+%scheme %{ (load-extension "./libexample.so" "SWIG_init") %}
</pre>
</div>
@@ -225,7 +235,7 @@ shared libraries into Guile; all bindings are automatically put in
newly created Guile modules.
<div class="targetlang">
<pre>
-(define my-so (dynamic-link "./foo.so"))
+(define my-so (dynamic-link "./libfoo.so"))
;; create new module and put bindings there:
(dynamic-call "scm_init_my_modules_foo_module" my-so)
</pre>
@@ -233,7 +243,7 @@ newly created Guile modules.
Newer Guile versions have a shorthand procedure for this:
<div class="targetlang">
<pre>
-(load-extension "./foo.so" "scm_init_my_modules_foo_module")
+(load-extension "./libfoo.so" "scm_init_my_modules_foo_module")
</pre>
</div>
</ul>
@@ -768,10 +778,10 @@ and might conflict with names from the GOOPS guile-module (see above). Pass the
argument to solve this problem. If the <code>-exportprimitive</code> option is passed to SWIG the
<code>(export ...)</code> code that would be exported into the scmstub file is exported at the bottom
of the generated GOOPS guile-module.
-The <code>%goops</code> directive should contain code to load the .so library.
+The <code>%goops</code> directive should contain code to load the shared library.
<div class="code"><pre>
-%goops %{ (load-extension "./foo.so" "scm_init_my_modules_foo_module") %}
+%goops %{ (load-extension "./libfoo.so" "scm_init_my_modules_foo_module") %}
</pre></div>
<p>
@@ -783,7 +793,7 @@ Produces the following code at the top of the generated GOOPS guile-module
(define-module (my modules foo))
;; %goops directive goes here
-(load-extension "./foo.so" "scm_init_my_modules_foo_module")
+(load-extension "./libfoo.so" "scm_init_my_modules_foo_module")
(use-modules (oop goops) (Swig common))
</pre></div>
@@ -791,7 +801,7 @@ Produces the following code at the top of the generated GOOPS guile-module
<li><p><b>Passive Linkage with -scmstub</b>: Here, the name of the scmstub file should be
<code>Module-primitive.scm</code> (with <i>primitive</i> replaced with whatever is given with the <code>-primsuffix</code>
-argument. The code to load the <code>.so</code> library should be located in the <code>%scheme</code> directive,
+argument. The code to load the shared library should be located in the <code>%scheme</code> directive,
which will then be added to the scmstub file.
SWIG will automatically generate the line <code>(use-modules (<i>Package</i> <i>Module-primitive</i>))</code>
into the GOOPS guile-module. So if <i>Module-primitive.scm</i> is on the autoload path for guile, the
@@ -799,7 +809,7 @@ into the GOOPS guile-module. So if <i>Module-primitive.scm</i> is on the autolo
whatever code is needed to load the <i>Module-primitive.scm</i> file into guile.</p>
<div class="targetlang"><pre>
-%scheme %{ (load-extension "./foo.so" "scm_init_my_modules_foo_module") %}
+%scheme %{ (load-extension "./libfoo.so" "scm_init_my_modules_foo_module") %}
// only include the following definition if (my modules foo) cannot
// be loaded automatically
%goops %{
@@ -832,7 +842,7 @@ SWIG will also automatically generate the line <code>(use-modules
directive should contain whatever code is needed to get that module loaded into guile.</p>
<div class="code"><pre>
-%goops %{ (load-extension "./foo.so" "scm_init_my_modules_foo_module") %}
+%goops %{ (load-extension "./libfoo.so" "scm_init_my_modules_foo_module") %}
</pre></div>
<p>
@@ -843,7 +853,7 @@ Produces the following code at the top of the generated GOOPS guile-module
(define-module (my modules foo))
;; %goops directive goes here (if any)
-(load-extension "./foo.so" "scm_init_my_modules_foo_module")
+(load-extension "./libfoo.so" "scm_init_my_modules_foo_module")
(use-modules (oop goops) (Swig common))
(use-modules ((my modules foo-primitive) :renamer (symbol-prefix-proc