From f4a4f8ec33bc43de1bf3df9bf922741fb80bfea5 Mon Sep 17 00:00:00 2001 From: Joshua Suskalo Date: Sat, 18 Sep 2021 17:30:26 -0500 Subject: [PATCH] Support looking up symbols in non-system libraries --- src/coffi/ffi.clj | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/coffi/ffi.clj b/src/coffi/ffi.clj index 6629c9b..a09d9b1 100644 --- a/src/coffi/ffi.clj +++ b/src/coffi/ffi.clj @@ -480,8 +480,9 @@ (defn find-symbol "Gets the [[MemoryAddress]] of a symbol from the loaded libraries." [sym] - ;; TODO(Joshua): Ensure this looks up both in the system, and loaded libraries (see `SymbolLookup#loaderLookup`) - (.. (CLinker/systemLookup) (lookup (name sym)) (orElse nil))) + (let [sym (name sym)] + (or (.. (CLinker/systemLookup) (lookup sym) (orElse nil)) + (.. (CLinker/systemLookup) (loaderLookup) (lookup sym) (orElse nil))))) (defn- method-type "Gets the [[MethodType]] for a set of `args` and `ret` types."