Portable foreign function interface for R7RS Small

Hello, I decided to write a little bit about one of my projects and I thought it might be of interest to people in here. It’s still in early stage but the consept works and I’m building other projects on top of it. Of which I will try to write about later too.

https://retropikzel.kapsi.fi/blog/2024-06-08%20-%20Portable%20foreign%20function%20interface%20for%20R7RS%20small.html

Feedback of both the library and blog post is appreciated. :slight_smile:

2 Likes

And here is the new one, much more hands on and propably illuminates things much better. I hope. :smile:
Retropikzel’s website - Blog - 2024-06-21 - r7rs-pffi libcurl example

2 Likes

Thanks, this is interesting. Makes me think about trying to use libcurl from an Emacs module, which has been discussed for years. It’s a shame that you can’t pass a callback through the FFI; that seems to be a serious drawback for this example.

Minor feedback: sometimes it’s hard to tell whether a code block is described by the paragraph before or after it. You might try to visually associate a code block with the descriptive text, or at least do something like write the descriptive paragraph before the code and end the paragraph with a colon, which would indicate that what it describes is to follow.

Also, there seem to be a couple of paragraphs and code blocks that are duplicated before the full code block.

Thanks for the feedback! I updated the post for more clarity. Some comments were before code blocks. Some after. Due to me trying to switch them around after writing the whole thing. I switched all to comment first then code and added some margin after the code block.

I chose my first example little poorly. I did not know that libcurl uses callbacks before I started writing. I’ve been using this mostly with SDL2 which does not use them at all to my knowledge. I did not make example with SDL2 (yet) as I thought libcurl would make shorter and easier example and be usefull to more people.

Now that I’ve encountered a place where callbacks are needed I have to at some point investigate if all the implementations I want to support, support callbacks. Having libcurl working would be tremendously usefull.

1 Like

Just update that callbacks are possible and I will be implementing support for them.

https://retropikzel.kapsi.fi/blog/2024-06-23%20-%20Investigating%20how%20to%20implement%20callbacks%20on%20r7rs-pffi%20and%20some%20reasoning%20behid%20why%20the%20library%20exists.html

1 Like

Support for callbacks in Sagittarius is already done.

https://retropikzel.kapsi.fi/blog/2024-06-29%20-%20Implementing%20callback%20support%20in%20r7rs-pffi%20for%20Sagittarius%20Scheme.html