unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Tim Meehan <btmeehan@gmail.com>
To: guile-user <guile-user@gnu.org>
Subject: foreign objects and the garbage collector
Date: Sat, 4 Sep 2021 07:41:49 -0500	[thread overview]
Message-ID: <CACgrOxLjPgUv2wtGbe+nqrAYxKc1BdeQYZ=M1ixGcVyPztK9GA@mail.gmail.com> (raw)

I was looking at writing something to interact with gpsd.
There is a shared memory interface, and a Unix socket interface. The
protocol spoken by gpsd is JSON, so I figured that I would just open up a
socket and start talking ... however ... really early on in the man page,
it says "it is a bad idea for clients to speak the protocol directly" (
https://gpsd.gitlab.io/gpsd/gpsd_json.html) presumably since the protocol
was likely to change? They didn't elaborate ...

There is a C interface described at (https://gpsd.gitlab.io/gpsd/libgps.html),
which has the familiar "open-and-get-opaque-thing" and
"close-opaque-thing-when-done" design.

I'd rather not compile anything in C, and just use the tools in Guile to
interact with libgps. Is there a way to get Guile's garbage collector to
call "gps_close" on the opaque structure returned by "gps_open"? Or is this
something that would be more handily implemented in a C extension?

Right now, because I'm just not concerned about sloppiness, I've just been
speaking the wire protocol, but I do feel bad about being sloppy and wanted
to clean it up for others to use perhaps.


             reply	other threads:[~2021-09-04 12:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-04 12:41 Tim Meehan [this message]
2021-09-04 13:35 ` foreign objects and the garbage collector Vivien Kraus via General Guile related discussions
2021-09-05  0:58   ` Tim Meehan
2021-09-19  6:14   ` adriano
2021-09-19 18:11     ` Olivier Dion via General Guile related discussions
2021-09-19 18:23       ` Maxime Devos
2021-09-21 14:26         ` adriano
2021-09-21 18:49           ` Maxime Devos
2021-09-21 14:00       ` adriano
2021-09-21 14:25         ` Olivier Dion via General Guile related discussions
2021-09-21 14:51           ` adriano

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='CACgrOxLjPgUv2wtGbe+nqrAYxKc1BdeQYZ=M1ixGcVyPztK9GA@mail.gmail.com' \
    --to=btmeehan@gmail.com \
    --cc=guile-user@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).