From 391bb79cbaa914db2dbbe2edec5c2af1d76bed86 Mon Sep 17 00:00:00 2001 From: Brian Caine Date: Sat, 9 Jul 2016 21:39:28 -0400 Subject: Added support for guile's native pointer type --- Examples/test-suite/guile/argout_runme.scm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Examples/test-suite/guile/argout_runme.scm (limited to 'Examples/test-suite') diff --git a/Examples/test-suite/guile/argout_runme.scm b/Examples/test-suite/guile/argout_runme.scm new file mode 100644 index 000000000..8bbb96cc9 --- /dev/null +++ b/Examples/test-suite/guile/argout_runme.scm @@ -0,0 +1,16 @@ +;; tests support for native guile pointers +;; https://www.gnu.org/software/guile/manual/html_node/Void-Pointers-and-Byte-Access.html +(dynamic-call "scm_init_argout_module" (dynamic-link "./libargout")) + +(use-modules (srfi srfi-4) (system foreign)) + +(define initial-value 42) +(define some-s32-data (s32vector initial-value)) + +(if (not (= (incp (bytevector->pointer some-s32-data)) initial-value)) + (error "Didn't read s32 data" initial-value some-s32-data)) + +(if (not (= (s32vector-ref some-s32-data 0) (+ initial-value 1))) + (error "Failed to increment s32 data" some-s32-data)) + +(exit 0) -- cgit v1.2.1