mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 20:00:19 +02:00
Fix procedure->pointer' for functions returning
void'.
* libguile/foreign.c (unpack): Handle `FFI_TYPE_VOID'. * test-suite/tests/foreign.test ("procedure->pointer")["procedures returning void"]: New test. Reported by Tristan Colgate <tcolgate@gmail.com>.
This commit is contained in:
parent
572eef50c2
commit
443f25dcff
2 changed files with 13 additions and 0 deletions
|
@ -905,6 +905,9 @@ unpack (const ffi_type *type, void *loc, SCM x)
|
||||||
SCM_VALIDATE_POINTER (1, x);
|
SCM_VALIDATE_POINTER (1, x);
|
||||||
*(void **) loc = SCM_POINTER_VALUE (x);
|
*(void **) loc = SCM_POINTER_VALUE (x);
|
||||||
break;
|
break;
|
||||||
|
case FFI_TYPE_VOID:
|
||||||
|
/* Do nothing. */
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,6 +225,16 @@
|
||||||
(arg3 (map (cut / <> 4.0) (iota 123 100 4))))
|
(arg3 (map (cut / <> 4.0) (iota 123 100 4))))
|
||||||
(equal? (map proc arg1 arg2 arg3)
|
(equal? (map proc arg1 arg2 arg3)
|
||||||
(map proc* arg1 arg2 arg3)))
|
(map proc* arg1 arg2 arg3)))
|
||||||
|
(throw 'unresolved)))
|
||||||
|
|
||||||
|
(pass-if "procedures returning void"
|
||||||
|
(if (defined? 'procedure->pointer)
|
||||||
|
(let* ((called? #f)
|
||||||
|
(proc (lambda () (set! called? #t)))
|
||||||
|
(pointer (procedure->pointer void proc '()))
|
||||||
|
(proc* (pointer->procedure void pointer '())))
|
||||||
|
(proc*)
|
||||||
|
called?)
|
||||||
(throw 'unresolved))))
|
(throw 'unresolved))))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue