diff options
author | Ludovic Courtès <ludo@gnu.org> | 2010-09-03 15:12:54 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2010-09-03 15:26:37 +0200 |
commit | 33186356668fe7697a8f2692660aaff69178d720 (patch) | |
tree | ec54e0b939ee5abccd30b9e1a1c76970e921dbf4 /module/system/foreign.scm | |
parent | a148c752ba7adf0d2005cc7bc5928a2dde467609 (diff) | |
download | guile-33186356668fe7697a8f2692660aaff69178d720.tar.gz |
Add `procedure->pointer' to the FFI.
* libguile/foreign.c (make_cif): New procedure, with code formerly in
`scm_make_foreign_function'.
(scm_make_foreign_function): Use it.
(invoke_closure, scm_procedure_to_pointer)[FFI_CLOSURES]: New
functions.
* libguile/foreign.h (scm_procedure_to_pointer): New declaration.
* module/system/foreign.scm: Export `procedure->pointer' when available.
* test-suite/standalone/test-ffi (f-callback-1, f-callback-2): New
procedures and related tests.
* test-suite/standalone/test-ffi-lib.c (test_ffi_callback_1,
test_ffi_callback_2): New functions.
* test-suite/tests/foreign.test ("procedure->pointer"): New test prefix.
* doc/ref/api-foreign.texi (Dynamic FFI): Document `procedure->pointer'.
Diffstat (limited to 'module/system/foreign.scm')
-rw-r--r-- | module/system/foreign.scm | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/module/system/foreign.scm b/module/system/foreign.scm index e9a4a7c7a..0ca7fbf4c 100644 --- a/module/system/foreign.scm +++ b/module/system/foreign.scm @@ -43,6 +43,7 @@ pointer->string make-foreign-function + ;; procedure->pointer (see below) make-c-struct parse-c-struct)) (load-extension (string-append "libguile-" (effective-version)) @@ -57,6 +58,8 @@ "Return true if POINTER is the null pointer." (= (pointer-address pointer) 0)) +(if (defined? 'procedure->pointer) + (export procedure->pointer)) ;;; |