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.
This commit is contained in:
William S Fulton 2013-05-08 12:42:17 +01:00
commit 70b9df5ee9
31 changed files with 54 additions and 44 deletions

View file

@ -1,6 +1,6 @@
;;; Test out some multi-argument typemaps
(dynamic-call "scm_init_example_module" (dynamic-link "./libexample.so"))
(dynamic-call "scm_init_example_module" (dynamic-link "./libexample"))
; Call the GCD function

View file

@ -1,5 +1,5 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
(dynamic-call "scm_init_casts_module" (dynamic-link "./libcasts.so"))
(dynamic-call "scm_init_casts_module" (dynamic-link "./libcasts"))
(load "../schemerunme/casts.scm")

View file

@ -1,5 +1,5 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
(dynamic-call "scm_init_char_constant_module" (dynamic-link "./libchar_constant.so"))
(dynamic-call "scm_init_char_constant_module" (dynamic-link "./libchar_constant"))
(load "../schemerunme/char_constant.scm")

View file

@ -1,2 +1,2 @@
(dynamic-call "scm_init_class_ignore_module" (dynamic-link "./libclass_ignore.so"))
(dynamic-call "scm_init_class_ignore_module" (dynamic-link "./libclass_ignore"))
(load "../schemerunme/class_ignore.scm")

View file

@ -1,2 +1,2 @@
(dynamic-call "scm_init_constover_module" (dynamic-link "./libconstover.so"))
(dynamic-call "scm_init_constover_module" (dynamic-link "./libconstover"))
(load "../schemerunme/constover.scm")

View file

@ -1,6 +1,6 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
(dynamic-call "scm_init_contract_module" (dynamic-link "./libcontract.so"))
(dynamic-call "scm_init_contract_module" (dynamic-link "./libcontract"))
(load "testsuite.scm")
(load "../schemerunme/contract.scm")

View file

@ -1,5 +1,5 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
(dynamic-call "scm_init_cpp_enum_module" (dynamic-link "./libcpp_enum.so"))
(dynamic-call "scm_init_cpp_enum_module" (dynamic-link "./libcpp_enum"))
(load "../schemerunme/cpp_enum.scm")

View file

@ -1,2 +1,2 @@
(dynamic-call "scm_init_cpp_namespace_module" (dynamic-link "./libcpp_namespace.so"))
(dynamic-call "scm_init_cpp_namespace_module" (dynamic-link "./libcpp_namespace"))
(load "../schemerunme/cpp_namespace.scm")

View file

@ -1,2 +1,2 @@
(dynamic-call "scm_init_dynamic_cast_module" (dynamic-link "./libdynamic_cast.so"))
(dynamic-call "scm_init_dynamic_cast_module" (dynamic-link "./libdynamic_cast"))
(load "../schemerunme/dynamic_cast.scm")

View file

@ -1,4 +1,4 @@
(dynamic-call "scm_init_guile_ext_test_module" (dynamic-link "./libguile_ext_test.so"))
(dynamic-call "scm_init_guile_ext_test_module" (dynamic-link "./libguile_ext_test"))
; This is a test for SF Bug 1573892
; If IsPointer is called before TypeQuery, the test-is-pointer will fail

View file

@ -1,2 +1,2 @@
(dynamic-call "scm_init_import_nomodule_module" (dynamic-link "./libimport_nomodule.so"))
(dynamic-call "scm_init_import_nomodule_module" (dynamic-link "./libimport_nomodule"))
(load "../schemerunme/import_nomodule.scm")

View file

@ -6,6 +6,6 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
(dynamic-call "scm_init_imports_a_module" (dynamic-link "./libimports_a.so"))
(dynamic-call "scm_init_imports_b_module" (dynamic-link "./libimports_b.so"))
(dynamic-call "scm_init_imports_a_module" (dynamic-link "./libimports_a"))
(dynamic-call "scm_init_imports_b_module" (dynamic-link "./libimports_b"))
(load "../schemerunme/imports.scm")

View file

@ -1,2 +1,2 @@
(dynamic-call "scm_init_inherit_missing_module" (dynamic-link "./libinherit_missing.so"))
(dynamic-call "scm_init_inherit_missing_module" (dynamic-link "./libinherit_missing"))
(load "../schemerunme/inherit_missing.scm")

View file

@ -1,7 +1,7 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
(dynamic-call "scm_init_integers_module" (dynamic-link "./libintegers.so"))
(dynamic-call "scm_init_integers_module" (dynamic-link "./libintegers"))
(define-macro (throws-exception? form)
`(catch #t

View file

@ -1,5 +1,5 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
(dynamic-call "scm_init_li_std_string_module" (dynamic-link "./libli_std_string.so"))
(dynamic-call "scm_init_li_std_string_module" (dynamic-link "./libli_std_string"))
(load "../schemerunme/li_std_string.scm")

View file

@ -4,7 +4,7 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
(dynamic-call "scm_init_li_typemaps_module" (dynamic-link "./libli_typemaps.so"))
(dynamic-call "scm_init_li_typemaps_module" (dynamic-link "./libli_typemaps"))
(load "../schemerunme/li_typemaps.scm")
(let ((lst (inoutr-int2 3 -2)))

View file

@ -1,5 +1,5 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
(dynamic-call "scm_init_list_vector_module" (dynamic-link "./liblist_vector.so"))
(dynamic-call "scm_init_list_vector_module" (dynamic-link "./liblist_vector"))
(load "../schemerunme/list_vector.scm")

View file

@ -3,5 +3,5 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
(dynamic-call "scm_init_multivalue_module" (dynamic-link "./libmultivalue.so"))
(dynamic-call "scm_init_multivalue_module" (dynamic-link "./libmultivalue"))
(load "../schemerunme/multivalue.scm")

View file

@ -1,5 +1,5 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
(dynamic-call "scm_init_name_module" (dynamic-link "./libname.so"))
(dynamic-call "scm_init_name_module" (dynamic-link "./libname"))
(load "../schemerunme/name.scm")

View file

@ -1,7 +1,7 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
(dynamic-call "scm_init_overload_complicated_module" (dynamic-link "./liboverload_complicated.so"))
(dynamic-call "scm_init_overload_complicated_module" (dynamic-link "./liboverload_complicated"))
(define-macro (check form)
`(if (not ,form)

View file

@ -1,2 +1,2 @@
(dynamic-call "scm_init_overload_copy_module" (dynamic-link "./liboverload_copy.so"))
(dynamic-call "scm_init_overload_copy_module" (dynamic-link "./liboverload_copy"))
(load "../schemerunme/overload_copy.scm")

View file

@ -1,2 +1,2 @@
(dynamic-call "scm_init_overload_extend_module" (dynamic-link "./liboverload_extend.so"))
(dynamic-call "scm_init_overload_extend_module" (dynamic-link "./liboverload_extend"))
(load "../schemerunme/overload_extend.scm")

View file

@ -1,5 +1,5 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
(dynamic-call "scm_init_overload_simple_module" (dynamic-link "./liboverload_simple.so"))
(dynamic-call "scm_init_overload_simple_module" (dynamic-link "./liboverload_simple"))
(load "../schemerunme/overload_simple.scm")

View file

@ -1,5 +1,5 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
(dynamic-call "scm_init_overload_subtype_module" (dynamic-link "./liboverload_subtype.so"))
(dynamic-call "scm_init_overload_subtype_module" (dynamic-link "./liboverload_subtype"))
(load "../schemerunme/overload_subtype.scm")

View file

@ -1,5 +1,5 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
(dynamic-call "scm_init_pointer_in_out_module" (dynamic-link "./libpointer_in_out.so"))
(dynamic-call "scm_init_pointer_in_out_module" (dynamic-link "./libpointer_in_out"))
(load "../schemerunme/pointer_in_out.scm")

View file

@ -1,3 +1,3 @@
; copied from python runme_.py
(dynamic-call "scm_init_reference_global_vars_module" (dynamic-link "./libreference_global_vars.so"))
(dynamic-call "scm_init_reference_global_vars_module" (dynamic-link "./libreference_global_vars"))
(load "../schemerunme/reference_global_vars.scm")

View file

@ -1,7 +1,7 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
(dynamic-call "scm_init_throw_exception_module" (dynamic-link "./libthrow_exception.so"))
(dynamic-call "scm_init_throw_exception_module" (dynamic-link "./libthrow_exception"))
(define-macro (check-throw form)
`(catch 'swig-exception

View file

@ -1,2 +1,2 @@
(dynamic-call "scm_init_typedef_inherit_module" (dynamic-link "./libtypedef_inherit.so"))
(dynamic-call "scm_init_typedef_inherit_module" (dynamic-link "./libtypedef_inherit"))
(load "../schemerunme/typedef_inherit.scm")

View file

@ -1,3 +1,3 @@
(dynamic-call "scm_init_typename_module" (dynamic-link "./libtypename.so"))
;;(dynamic-call "scm_init_types_module" (dynamic-link "./libtypes.so"))
(dynamic-call "scm_init_typename_module" (dynamic-link "./libtypename"))
;;(dynamic-call "scm_init_types_module" (dynamic-link "./libtypes"))
(load "../schemerunme/typename.scm")

View file

@ -4,5 +4,5 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
(dynamic-call "scm_init_unions_module" (dynamic-link "./libunions.so"))
(dynamic-call "scm_init_unions_module" (dynamic-link "./libunions"))
(load "../schemerunme/unions.scm")