From ab82b6a5a1c54bb4eaebdf31938644795aed2a12 Mon Sep 17 00:00:00 2001 From: Joshua Suskalo Date: Wed, 6 Oct 2021 19:37:15 -0500 Subject: [PATCH] Fix a bug where non-primitive argument types failed to link --- CHANGELOG.md | 2 ++ src/clj/coffi/ffi.clj | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f2e455..edaf2e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/). ## [Unreleased] +### Fixed +- Non-primitive argument types fail to link ## [0.1.205] - 2021-10-06 ### Added diff --git a/src/clj/coffi/ffi.clj b/src/clj/coffi/ffi.clj index bfb497f..b44c6c9 100644 --- a/src/clj/coffi/ffi.clj +++ b/src/clj/coffi/ffi.clj @@ -20,6 +20,7 @@ CLinker FunctionDescriptor MemoryLayout + MemorySegment SegmentAllocator))) ;;; FFI Code loading and function access @@ -108,10 +109,10 @@ (defn- insn-layout "Gets the type keyword or class for referring to the type in bytecode." [type] - (when-some [prim (mem/primitive-type type)] - (if (not= prim ::mem/pointer) - (keyword (name prim)) - (mem/java-layout type)))) + (or (when-some [prim (mem/primitive-type type)] + (when (not= prim ::mem/pointer) + (keyword (name prim)))) + (mem/java-layout type))) (def ^:private unbox-fn-for-type "Map from type name to the name of its unboxing function."