[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: type of arg 2 to scm_object_to_string ?
From: |
Marius Vollmer |
Subject: |
Re: type of arg 2 to scm_object_to_string ? |
Date: |
Wed, 22 Sep 2004 03:35:13 +0200 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Tano Fotang <address@hidden> writes:
> I did:
>
> SCM my_result = scm_object_to_string(my_object, scm_display);
>
> and get the following compiler warning:
>
> our_guile.c:228: warning: passing arg 2 of `scm_object_to_string'
> from incompatible pointer type
The second argument of scm_object_to_string is a SCM value, not a C
procedure. You could do:
display_proc = scm_variable_ref (scm_c_lookup ("display"));
my_result = scm_object_to_string (my_object, display_proc);
Or you could use scm_simple_format:
format_string = scm_from_locale_string ("~a");
my_result = scm_simple_format (SCM_BOOL_F, format_string, my_object);
Both display_proc and format_string need only be computed once, of
course, but should be protected with scm_gc_protect_object when they
are stored in a global variable.
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405