Fork me on GitHub

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, for the qualified version, I lookup the method at startup, and store it in a global, varQualM.

varQualM   = (*env)->GetStaticMethodID(env, clojure, "var",
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.

Alex Miller (Clojure team)12:07:33

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

Alex Miller (Clojure team)16:07:16

Sorry, misread that, but same