This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-04
Channels
- # announcements (4)
- # aws (3)
- # babashka (58)
- # beginners (59)
- # biff (6)
- # cider (3)
- # clj-kondo (48)
- # clj-on-windows (1)
- # cljdoc (1)
- # clojure (136)
- # clojure-europe (19)
- # clojure-gamedev (7)
- # clojure-germany (2)
- # clojure-nl (7)
- # clojure-norway (1)
- # clojure-portugal (1)
- # clojure-uk (4)
- # clojurescript (41)
- # community-development (2)
- # core-async (5)
- # cursive (10)
- # data-oriented-programming (1)
- # data-science (1)
- # datahike (5)
- # datomic (60)
- # docker (2)
- # emacs (13)
- # figwheel-main (19)
- # fulcro (12)
- # graalvm (9)
- # holy-lambda (41)
- # honeysql (14)
- # introduce-yourself (3)
- # jobs (4)
- # lsp (11)
- # nrepl (1)
- # off-topic (9)
- # other-languages (2)
- # pathom (22)
- # portal (5)
- # re-frame (17)
- # remote-jobs (4)
- # reveal (14)
- # shadow-cljs (1)
- # tools-build (7)
- # tools-deps (47)
- # xtdb (8)
- # yada (2)
Hello! Posting a duplicate of a question I posted in the GraalVM Slack here, just in case someone here knows. It's not Clojure specific, but it is used in a Clojure project 🙂 Can someone point me to docs about callbacks from C to Java when using native image? I found an example but it does not work, I guess the interface was changed. Any CEntryPoint now requires an isolate parameter, which obviously the C library will not know anything about because I did not write that code, it's a third party C library that assumes the callback is also written in C. If I can't do this via CEntryPoint, what is the preferred way?
This is the function I want to supply a callback to: https://www.glfw.org/docs/latest/group__input.html#ga1caf18159767e761185e49a3be019f8d
Maybe @U0A74MRCJ knows this.
https://github.com/michael-simons/neo4j-java-driver-native-lib has examples for this use case I believe.
I haven't found a better way than creating a small c wrapper. Would be interested to hear if you find another good option!
Turns out I was just not using the svm jar and module... But even with that I can't get anything to work. When the callback comes back from C, global variables that I previously set are now null. Is this something to do with isolates?
Actually, it is really important to have the same isolate everywhere or data will magically vanish. So there is no way to make a reliable callback from C to Java without wrapper functions on the C side taking care of the isolates. That kind of sucks. But at least the C code can get compiled by the native-image builder so there is no separate step for it.