This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-15
Channels
- # announcements (3)
- # aws (2)
- # babashka (57)
- # beginners (24)
- # clj-kondo (5)
- # clj-together (3)
- # cljs-dev (11)
- # clojure (83)
- # clojure-australia (1)
- # clojure-china (1)
- # clojure-europe (32)
- # clojure-filipino (1)
- # clojure-hk (5)
- # clojure-indonesia (1)
- # clojure-japan (1)
- # clojure-korea (1)
- # clojure-my (1)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojure-sg (1)
- # clojure-spain (1)
- # clojure-taiwan (1)
- # clojure-uk (2)
- # clojurescript (7)
- # conjure (36)
- # data-science (19)
- # datomic (27)
- # emacs (44)
- # events (4)
- # fulcro (16)
- # honeysql (6)
- # inf-clojure (1)
- # interop (5)
- # malli (5)
- # nbb (1)
- # off-topic (19)
- # pathom (4)
- # practicalli (1)
- # remote-jobs (4)
- # ring (1)
- # shadow-cljs (72)
- # spacemacs (2)
Thanks, that option helped get rid of some other spec errors, though I still needed to add the jar.
Do you know of anything weird with the JNI and getting method ids for clojure classes? I'm calling GetStaticMethodID
on clojure.java.api.Clojure/var
, for the qualified version, I lookup the method at startup, and store it in a global, varQualM
.
varQualM = (*env)->GetStaticMethodID(env, clojure, "var",
"(Ljava/lang/Object;Ljava/lang/Object;)Lclojure/lang/IFn;");
Then later, I call it:
r = (*env)->CallStaticObjectMethod(env, clojure, varQualM, ns, fn);
If I run the call from a main
function in C, it works, but if I run it from within Haskell, through an FFI call, it crashes because it jumps into some weird part of the JVM that isn't really the method.
However, if I do a fresh call of GetStaticMethodID
right before the call, instead of using the global varQualM
id set at startup, the Haskell version works. And printing them out, the two id's are different.
Does the clojure method table change when clojure loads?
The java people normally recommend caching your calls to GetStaticMethodID
, but maybe since clojure only has a few methods, it would be cheap enough to do a fresh lookup each time.I wouldn't expect that to change. Var is a class, should be loaded once, nothing weird there. Might depend which class loader you're looking at I guess
var
is a method in the Clojure
class. it might have something to do with haskell doing some automatic threading
Sorry, misread that, but same