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
392 B
20 lines
392 B
|
|
(in-package #:cl-rng-ffi)
|
|
|
|
(define-foreign-library libsrng
|
|
(:unix (:or "libsrng.so" "libsrng" "./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)
|