From 65848c72eb86fb846937737de1ab7994ae5570be Mon Sep 17 00:00:00 2001 From: Joshua Suskalo Date: Sat, 25 Sep 2021 08:38:56 -0500 Subject: [PATCH] Add function for making a varargs cfn factory with serde wrapper --- src/clj/coffi/ffi.clj | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/clj/coffi/ffi.clj b/src/clj/coffi/ffi.clj index 1ca8429..a81583e 100644 --- a/src/clj/coffi/ffi.clj +++ b/src/clj/coffi/ffi.clj @@ -836,6 +836,18 @@ (make-downcall args ret) (make-serde-wrapper args ret))) +(defn vacfn-factory + "Constructs a varargs factory to call the native function referenced by `symbol`. + + The function returned takes any number of type arguments and returns a + specialized Clojure function for calling the native function with those + arguments." + [symbol required-args ret] + (-> symbol + ensure-address + (make-varargs-factory required-args ret) + (make-serde-varargs-wrapper required-args ret))) + ;;; Function types (def ^:private return-for-type