You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
442 B
20 lines
442 B
|
|
(in-package #:cl-rng-ffi)
|
|
|
|
(define-foreign-library libsrng
|
|
(:unix (:or "libsrng.so" "libsrng" "./libsrng.so" "/usr/lib/libsrng.so" "/usr/local/lib/libsrng.so"))
|
|
(t (:default "libsrng")))
|
|
|
|
(use-foreign-library libsrng)
|
|
|
|
(defcfun "sample" :int (to :pointer))
|
|
|
|
(defun ffi-sample ()
|
|
(with-foreign-pointer (value 8)
|
|
(let ((rval (sample value)))
|
|
(values
|
|
(mem-ref value :double 0)
|
|
(= rval 1)))))
|
|
|
|
(export 'ffi-sample)
|