[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing C pointers through guile

From: Kjetil S. Matheussen
Subject: Re: Passing C pointers through guile
Date: Thu, 10 Jul 2008 14:49:50 +0200 (CEST)

Ludovic Court?s:

Well, `' has an `AC_PREREQ' call, 1.10(.1) is the latest
Automake, and 1.5.26 is the latest Libtool of the 1.x series, it's

Thanks, I didn't know that.

No.  `configure' checks the size of a number of (integer) types.  The
idea here would be to have a check for `void *' (if there isn't one
already); then in `numbers.h', you'd add something along the lines of:

 #define scm_to_uintptr scm_to_uint32
 #elif SCM_SIZEOF_VOID_P == 8
 #define scm_to_uintptr scm_to_uint64
 #error "strange `void *'"

IOW, don't rely on <stdint.h> or <inttypes.h>.

Good idea. Much better. I'll do that.

That's true. But at least my experience is that using guardians
is cleaner than smurf's.

Smurf?  Smurf's what?

Oops. :-)
I ment SMOB.

If so, the deallocation routine that's called from the guardian (which
is necessarily written in C) is roughly the same as the one you'd pass
to `scm_set_smob_free ()'.

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]