unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Attila Lendvai <attila@lendvai.name>
To: "Ludovic Courtès" <ludovic.courtes@inria.fr>
Cc: guix-devel@gnu.org, guile-user@gnu.org,
	Mathieu Othacehe <othacehe@gnu.org>
Subject: Re: Guile-Git 0.6.0 released; looking for maintainers!
Date: Tue, 27 Feb 2024 19:25:58 +0000	[thread overview]
Message-ID: <AAFu7hdakInVSQPUA6Ed8Wro6ZKXC8qnvfOvNi4gnSwluOH1t8jkM-jzUze1FUULUuHPb1BdRrTXImzXwH96IDsDWRSVVlBdOuCteBFxdBA=@lendvai.name> (raw)
In-Reply-To: <871q8yjl1l.fsf@inria.fr>

> An idea might be to look into using nyacc’s ffi-helper to generate
> struct definitions.


over there in CL land i wrote an automatic FFI generator. it's now part of the main CL FFI lib:

https://github.com/cffi/cffi/tree/master/src/c2ffi

it is based on c2ffi:

https://github.com/rpav/c2ffi

which is a piece of C++ code that uses CLANG as a library to parse any C header file, and emit its content into a json file.

a thin layer of lisp code can generate the actual sexp FFI definitions from the json files, that then can be hooked into the usual guile way of doing FFI.

the json files can be checked into the repo, which then eliminates the dependency on c2ffi on the user side (i.e. the project is only as heavy as any other hand-written FFI wrapper). that way only the maintainer needs to regenerate the json files every once in a while.

or short of a smarter build tool like ASDF, we can also check in the generated lisp files.

if there's interest, then i can help porting this over to guile.

below are some example projects that are using it. they are rather thin and simple, yet provide a full FFI:

https://github.com/hu-dwim/hu.dwim.zlib
https://github.com/hu-dwim/hu.dwim.sdl

PS: clang now supports `-ast-dump=json`, which may or may not eliminate the need for c2ffi entirely: https://github.com/rpav/c2ffi/issues/112

-- 
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“Sometimes I wonder whether the world is being run by smart people who are putting us on or by imbeciles who really mean it.”
	— Mark Twain (1835-1910)




      reply	other threads:[~2024-02-27 19:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27  9:47 Guile-Git 0.6.0 released; looking for maintainers! Ludovic Courtès
2024-02-27 19:25 ` Attila Lendvai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AAFu7hdakInVSQPUA6Ed8Wro6ZKXC8qnvfOvNi4gnSwluOH1t8jkM-jzUze1FUULUuHPb1BdRrTXImzXwH96IDsDWRSVVlBdOuCteBFxdBA=@lendvai.name' \
    --to=attila@lendvai.name \
    --cc=guile-user@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=ludovic.courtes@inria.fr \
    --cc=othacehe@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).