From a0aa777afe82a56902dc2d2bb899e3b051146343 Mon Sep 17 00:00:00 2001 From: Holger Pirk Date: Fri, 22 Dec 2017 22:26:51 +0100 Subject: [PATCH] added a (crashing) test that calls an ffi-function from a callback --- test.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test.el b/test.el index 6e06926..1ba3133 100644 --- a/test.el +++ b/test.el @@ -34,6 +34,15 @@ (ert-deftest ffi-add () (should (eq (test-add 23 -23) 0))) +(defun callback-with-ffi-add-call (arg) + (test-add 1 arg) + ) + +(ert-deftest ffi-call-callback-with-ffi-add-call () + (let* ((cif (ffi--prep-cif :int [:int])) + (pointer-to-callback (ffi-make-closure cif #'callback-with-ffi-add-call))) + (should (eq (test-call-callback pointer-to-callback) "hello")))) + (ert-deftest ffi-struct-layout () (let ((struct-type (ffi--define-struct :int))) (should (eq (ffi--type-size struct-type)