[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
static variables with scheme objects
From: |
sig |
Subject: |
static variables with scheme objects |
Date: |
Wed, 16 Jul 2003 08:29:34 -0400 |
User-agent: |
Mutt/1.2.5.1i |
I'm writing an extension module to guile in C and I would like
to be able to have a global static variable in C which holds a
scheme object. Something like:
static SCM global_mutex;
void init() {
global_mutex = scm_make_mutex();
}
but it seems like doing this be dangerous as the garbage
collector would try to reclaim the object as its not an
immediate and the only reference is this global variable so
walking the stack wouldn't find it.
I thought about doing something like
void init() {
scm_c_define("global-mutex", scm_make_mutex());
}
but this has the problem of not being accessable from other top
level environments. Does anyone have some advice on how to get
around this?
cya
.sig
- static variables with scheme objects,
sig <=