unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Kjetil S. Matheussen" <k.s.matheussen@notam02.no>
To: guile-user@gnu.org
Subject: Re: Passing C pointers through guile
Date: Thu, 10 Jul 2008 14:54:49 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0807101451180.5265@ttleush> (raw)

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1589 bytes --]


Ludovic Courtès:
> > Sure, if you just do this now and then, SMOBs aren't a problem.
> > But that doesn't change the fact that all the functionality SMOB
> > provides is overkill when the only thing you need is to hold
> > a pointer.
> 
> It's not overkill, it's exactly what you need: disjoint SMOB type,
> `free' and `mark' procedures.

My point is that SMOB's are overkill if you _don't_ need either free or 
mark.


> > For those who needs the full functionality of SMOB's, or need
> > the extra speed and memory advantages of SMOB's, they are free
> > to use SMOB's. If not, the functions scm_to/from_uintptr
> > can be used instead, which is a billion times easier to use.
> 
> Not really: as mentioned on `guile-devel', you'll need to implement that
> functionality (disjoint type, garbage collection) on top of your
> integer.  One advantage is that this can be done in Scheme (except for
> the `mark' procedure, but it's not always needed); the main drawback in
> the context of Guile is poor performance.

I'm just copying my answer to the guile-devel mailing list:

"
Point is that you very often don't need any kind of free functionality.
For example, if you create a gui widget, you probably have a callback
function which is called if the gui is closed. That callback
function can free any allocated memory. Another example from snd
is creating ladspa plugins (audio plugins in linux). Handlers
from those, plus variuos configuration stuff, is alive througout
the whole session and will be automatically freed when the program
closes.
"

             reply	other threads:[~2008-07-10 12:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-10 12:54 Kjetil S. Matheussen [this message]
     [not found] <cmu-lmtpd-16223-1215360367-2@mail-imap1.uio.no>
2008-07-06 16:13 ` Passing C pointers through guile Kjetil S. Matheussen
2008-07-06 19:20   ` Ludovic Courtès
2008-07-09 16:48   ` Greg Troxel
2008-07-09 16:55     ` Kjetil S. Matheussen
2008-07-09 19:54       ` Ludovic Courtès
2008-07-10 15:11       ` Ken Raeburn
2008-07-23 11:19         ` Greg Troxel
  -- strict thread matches above, loose matches on Subject: below --
2008-07-04 22:18 Maciek Godek
2008-07-05 16:59 ` Ludovic Courtès

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=Pine.LNX.4.64.0807101451180.5265@ttleush \
    --to=k.s.matheussen@notam02.no \
    --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).