Sender | Message | Time |
---|---|---|
2 May 2022 | ||
10:06:06 | ||
10:18:38 | ||
16:57:28 | ||
4 May 2022 | ||
02:06:03 | ||
02:06:34 | ||
02:29:27 | ||
In reply to @tho1efx:matrix.orgNot really a general case, but when I was experimenting with sound I did a CFFI binding to JACK. Otherwise I imagine you'd have to pick what sound library you want to interact with and do the same. | 02:59:30 | |
In reply to @tho1efx:matrix.org* Not really a general case, but when I was experimenting with sound I did a CFFI binding to JACK. Otherwise I imagine you'd have to pick what sound library you want to interact with and do the same. My binding was under SBCL. | 02:59:57 | |
03:04:26 | ||
Did you use a tool for the binding or write it yourself? | 03:26:33 | |
03:52:11 | ||
03:52:58 | ||
19:42:06 | ||
5 May 2022 | ||
In reply to @tho1efx:matrix.orgWrote it myself. I settled on SBCL and CFFI after toying around with other lisps. Unfortunately they couldn't handle the foreign thread callback requirement of JACK. In my opinion Common Lisp + CFFI is the best toolset for interacting with C code I've used. | 04:46:45 | |
Have you used Lua's FFI? | 04:52:03 | |
08:14:49 | ||
Thank's for the tips let-over-lambda | 17:28:52 | |
In reply to @an_origamian:matrix.orgI haven't tried Lua in a serious sense that way, although I like the ideas behind it. It's not so much that there's issues calling into C in most languages, although some languages make it unnecessarily difficult (i.e. JNI (can't wait for the new foreign API to finally give the JVM proper FFI support)), the issues arise when going the other way and being able to wrap your functions as callbacks that C can call. If that can be cleared the next issue is that those callbacks must be able to be called at arbitrary times. Some runtimes like Chicken Scheme cannot handle that (correct me if I'm wrong but I tried). Unless a language/runtime can provide that level of integration as a starting base, I don't see it as a "real" FFI. We can stack on additional features such as having union, struct, and bitfield support, padding configuration support, signed/unsigned support, runtime definition of callbacks that can be changed while retaining callback address etc. SBCL/CFFI provides these things and more. If Lua's FFI achieves parity (you tell me) with CFFI I would be interested in it but otherwise no. To give a better idea of what I have tried, my main stack I turn to is C, Common Lisp, Clojure, and C++ if C/Common Lisp aren't appropriate. I have yet to try Haskell, but I'm not sure if it's appropriate. | 17:48:01 | |
In reply to @tho1efx:matrix.org1 more for you, don't forget about macros when wrapping APIs (web or native). | 17:51:54 | |
6 May 2022 | ||
Yes. Lua callbacks can be called at arbitrary times. It's known for it's good interoperability with C, so I was wondering if SBCL's FFI was any better, because I would love to take a look at it if it is. I've been thinking about using lisp for embedded languages.
I'm pretty sure Lua doesn't have all of those, especially since its goal is to be minimal. I think you can add new C types to it though. Not sure how. Sounded kind of hacky. | 02:49:51 | |
I think it'd be good to check out. You can view the manual https://cffi.common-lisp.dev/manual/cffi-manual.html . However, Common Lisp isn't really something to embed. It works best the other way around by slaving other things to it (as most languages/runtimes do). Scheme implementations often tout embedding if that's your focus and you want to stick with a Lisp dialect. If possible, starting your application in Common Lisp or Clojure can obviate the need for an embedded language to begin with since your REPL will provide so much at runtime. A nice data format such as Clojure's EDN could also fill in that role depending on your needs. | 03:10:39 | |
Yes, Scheme would probably be better. | 03:33:30 | |
Or write my own :P | 03:34:15 | |
A lot of Lisp implementations support embedding. Lispworks, Allegro, ECL, and recently SBCL | 10:11:40 | |
15:52:44 | ||
7 May 2022 | ||
18:06:46 | ||
8 May 2022 | ||
01:52:16 | ||
22:45:31 | ||
9 May 2022 | ||
10:00:59 | ||
10 May 2022 | ||
17:50:36 |