bug-guile
[Top][All Lists]
Advanced

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

Doc--protecting guile entities defined in C


From: Pascal Cedraschi
Subject: Doc--protecting guile entities defined in C
Date: 02 Jun 2003 22:46:58 +0200

Dear Guile Maintainer,

I am using Guile 1.6.4 on a Debian (unstable) based i686--actually I do
not think the exact architecture is especially important since what I am
reporting is rather a problem with the documentation.  I would like to
define symbols for use in Guile and C code in the C code where I also
initialise (with `scm_c_define_gsubr') the C functions that have an
interface in Guile.  I have tried defining a global (in C) SCM variable
and setting the symbol's name with `scm_str2symbol' but the symbol thus
defined disappears unless I protect it (from the garbage collector?)
with `scm_gc_protect_object'.  Is that right?  Anyway, I have not been
able to find (in the Guile Reference Manual) an explanation of how to
define Guile symbols from the C startup code, and I think that should be
possible (to do it, and to find an explanation).

I have enclosed a complete example; it can be compiled using `gcc main.c
-lguile', and on the Guile command prompt, you can see the difference
between the symbols `exists' and `doesnt-exist' by typing

(equals-exists? 'exists)

and

(equals-doesnt-exist? 'doesnt-exist)

The functions `equals-exists?' and `equals-doesnt-exist?' are mirror
images of one another, as are the symbols `exists' and `doesnt-exist';
the only difference is that `exists' is protected using
`scm_gc_protect_object' while `doesnt-exist' is not...

Please let me know if you need more information.

Thanks,
Pascal Cedraschi

Attachment: main.c
Description: Text Data


reply via email to

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