This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-22
Channels
- # alda (2)
- # announcements (1)
- # babashka (32)
- # beginners (67)
- # calva (1)
- # cider (19)
- # clerk (11)
- # clj-commons (35)
- # clj-kondo (7)
- # cljsrn (2)
- # clojure (35)
- # clojure-europe (86)
- # clojure-nl (5)
- # clojure-norway (5)
- # clojure-russia (6)
- # clojurescript (16)
- # clr (21)
- # conjure (1)
- # core-async (10)
- # cryogen (1)
- # cursive (12)
- # data-science (1)
- # emacs (29)
- # events (4)
- # figwheel-main (2)
- # graalvm (9)
- # gratitude (7)
- # honeysql (4)
- # hugsql (3)
- # hyperfiddle (23)
- # jobs (1)
- # jobs-discuss (4)
- # joyride (9)
- # malli (2)
- # off-topic (81)
- # portal (7)
- # reagent (19)
- # reitit (1)
- # releases (4)
- # shadow-cljs (121)
- # xtdb (3)
Just wondering if anyone can point me at some example code that accepts and calls a c callback in a shared library compiled with Graal. I imagine I can work it out from the docs, but I'm fairly new to Graal, and the docs are a bit on the sparse side, so an example would be very useful. I haven't been able to turn one up, even just looking for one in Java.
I remember looking into this previously, but I don't think I ever found a direct method. However, graalvm now supports JNA, which does let you call function pointers, https://javadoc.io/static/net.java.dev.jna/jna/5.13.0/com/sun/jna/Function.html. I like using JNA since it's pretty straightforward and works under the jvm and graalvm.
It looks like you can accept function pointers, https://github.com/replikativ/datahike/blob/main/libdatahike/src/datahike/impl/LibDatahike.java#L94
Not that many examples though, https://grep.app/search?q=InvokeCFunctionPointer
OK, thank you very much! This looks really helpful. Doing things like this, that not many people have had to do yet, reminds me of my early days programming, before widely available internet. It's easy to forget how essential things like StackOverflow, etc. are for getting nuts and bolts stuff done.
http://grep.app is really a great resource for more obscure stuff like this.
Pretty sure I first learned about it from this slack. It's really too bad that github search isn't very useful.